2018-09-21 09:30:10 -04:00
|
|
|
class Hamming
|
2018-09-25 09:26:17 -04:00
|
|
|
def self.compute(strand_one, strand_two)
|
|
|
|
raise ArgumentError unless strand_one.length == strand_two.length
|
2018-09-21 09:30:10 -04:00
|
|
|
|
2018-09-25 09:26:17 -04:00
|
|
|
0.upto(strand_one.length - 1).count {|i| strand_one[i] != strand_two[i] }
|
2018-09-21 09:30:10 -04:00
|
|
|
end
|
|
|
|
end
|