Sha256: 0165176357d16c56a767bfb561ce452d48ed1f2a385d47873a49fb6c5abaa95d
Contents?: true
Size: 371 Bytes
Versions: 191
Compression:
Stored size: 371 Bytes
Contents
class Hamming(strand1: String, strand2: String) { def distance = if (strand1.length == strand2.length) { val dist = commonPairs.count { case (a, b) => a != b } Some(dist) } else None private def commonPairs = strand1.zip(strand2) } object Hamming { def compute(strand1: String, strand2: String) = new Hamming(strand1, strand2).distance }
Version data entries
191 entries across 191 versions & 1 rubygems