exercism/ruby/hamming/hamming.rb
James Walker b800f5729c
ruby - hamming (fixes)
use Enumerable.count and unless positive_conditional
2018-09-25 09:26:17 -04:00

8 lines
216 B
Ruby

class Hamming
def self.compute(strand_one, strand_two)
raise ArgumentError unless strand_one.length == strand_two.length
0.upto(strand_one.length - 1).count {|i| strand_one[i] != strand_two[i] }
end
end