62 words One minute
Python
Solution 1
1
2
|
def hamming_distance(seq1, seq2):
return sum(i != j for i, j in zip(seq1, seq2))
|
Solution 2
1
2
|
def hamming_distance(seq1, seq2):
return sum(seq1[i] != seq2[i] for i, _ in enumerate(seq1))
|
Solution 3
1
2
3
4
5
6
|
def hamming_distance(seq1, seq2):
count = 0
for i, _ in enumerate(seq1):
if seq1[i] != seq2[i]:
count += 1
return count
|