By definition from Wikipedia, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it is the number of substitutions required to transform one string into another. Given two strings of equal length, compute the Hamming distance.
So to find the how many differences there are between two strings, say we have two DNA strings A and B:
A = TGACCCGTTATGCTCGAGTTCGGTCAGAGCGTCATTGCGAGTAGTCGTTTGCTTTCTCAAACTCC B = GAGCGATTAAGCGTGACAGCCCCAGGGAACCCACAAAACGTGATCGCAGTCCATCCGATCATACA
Throw them to two arrays A and B. Therefore, If
(= count 0) (cond [(symbol=? A B) /do nothing just move on to the next pair of string] [else (add1 count)] ;; counter:= counter + 1;
output would be the counter.
Is this the right logic flow to go with this problem? Any suggestion to write this on python or Scheme?