/ruby/hamming/hamming.rb

1
2
3
4
5
6
7
8
9
class Hamming
  def self.compute(strand1, strand2)
    pairs(strand1, strand2).count{|a, b| a != b}
  end

  def self.pairs(strand1, strand2)
    strand1.chars.zip(strand2.chars)
  end
end

@swalberg thinks this looks great

Comments


You're not logged in right now. Please login via GitHub to comment