src/main/scala/hamming.scala

1
2
3
4
5
6
7
8
object Hamming {
  def compute(strand1: String, strand2: String): Integer = {
    if (strand1.length != strand2.length)
      throw new IllegalArgumentException("Strands must be the same length")

    strand1.zip(strand2).count(pair => pair._1 != pair._2)
  }
}

Comments


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