Hamming distance

The Hamming distance between two strings having the same length is the minimum number of symbol substitutions required to transform one string into the other. If the strings are given by $s_1$ and $s_2$, then we write the Hamming distance between them as $d_{\textrm{H}}(s_1, s_2)$.

We can compute the Hamming distance by visual inspection: the Hamming distance between two strings is simply the number of positions in the strings at which corresponding symbols differ. For example, the Hamming distance between the two strings in the figure below must be equal to 7.

Hamming Distance