My attempts at exercism.org
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 53 lines 1.6 kB view raw view rendered
1# Hamming 2 3Welcome to Hamming on Exercism's PHP Track. 4If you need help running the tests or submitting your code, check out `HELP.md`. 5 6## Introduction 7 8Your body is made up of cells that contain DNA. 9Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. 10In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime! 11 12When cells divide, their DNA replicates too. 13Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. 14If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred. 15This is known as the "Hamming distance". 16 17The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :) 18 19## Instructions 20 21Calculate the Hamming distance between two DNA strands. 22 23We read DNA using the letters C, A, G and T. 24Two strands might look like this: 25 26 GAGCCTACTAACGGGAT 27 CATCGTAATGACGGCCT 28 ^ ^ ^ ^ ^ ^^ 29 30They have 7 differences, and therefore the Hamming distance is 7. 31 32## Implementation notes 33 34The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work. 35 36## Source 37 38### Contributed to by 39 40- @arueckauer 41- @dkinzer 42- @Dog 43- @kip-13 44- @kunicmarko20 45- @kytrinyx 46- @lafent 47- @marvinrabe 48- @petemcfarlane 49- @rossbearman 50 51### Based on 52 53The Calculating Point Mutations problem at Rosalind - https://rosalind.info/problems/hamm/