Sha256: 088f54752fbefbb0dfa3b3917edb3b64746e663fc96d746d955aef9a344510f8
Contents?: true
Size: 372 Bytes
Versions: 205
Compression:
Stored size: 372 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 distance(strand1: String, strand2: String) = new Hamming(strand1, strand2).distance }
Version data entries
205 entries across 205 versions & 1 rubygems