exercism/ruby/hamming/hamming.rb

7 lines
144 B
Ruby
Raw Normal View History

2018-03-02 22:27:55 +00:00
class Hamming
def self.compute(a, b)
raise ArgumentError unless a.length == b.length
(0..a.length).count {|i| a[i] != b[i]}
end
end