You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/practice/hamming/.docs/instructions.md
-11
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,6 @@
2
2
3
3
Calculate the Hamming distance between two DNA strands.
4
4
5
-
Your body is made up of cells that contain DNA.
6
-
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
7
-
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
8
-
9
-
When cells divide, their DNA replicates too.
10
-
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
11
-
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
12
-
This is known as the "Hamming distance".
13
-
14
5
We read DNA using the letters C, A, G and T.
15
6
Two strands might look like this:
16
7
@@ -20,8 +11,6 @@ Two strands might look like this:
20
11
21
12
They have 7 differences, and therefore the Hamming distance is 7.
22
13
23
-
The Hamming distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
24
-
25
14
## Implementation notes
26
15
27
16
The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work.
You can check out the Wikipedia pages on [integer square root][integer-square-root] and [methods of computing square roots][computing-square-roots] to help with choosing a method of calculation.
We are launching a deep space exploration rocket and we need a way to make sure the navigation system stays on target.
4
+
5
+
As the first step in our calculation, we take a target number and find its square root (that is, the number that when multiplied by itself equals the target number).
6
+
7
+
The journey will be very long.
8
+
To make the batteries last as long as possible, we had to make our rocket's onboard computer very power efficient.
9
+
Unfortunately that means that we can't rely on fancy math libraries and functions, as they use more power.
10
+
Instead we want to implement our own square root calculation.
0 commit comments