Sha256: d90d65b8f33f9f796077265ece5ce29b8a239e5aafc85aa224d82eb521883ebf
Contents?: true
Size: 544 Bytes
Versions: 115
Compression:
Stored size: 544 Bytes
Contents
using System.Linq; public class Hamming { public static int Compute(string firstStrand, string secondStrand) { return new Hamming(firstStrand,secondStrand).Distance(); } private readonly string firstStrand; private readonly string secondStrand; public Hamming(string firstStrand, string secondStrand) { this.firstStrand = firstStrand; this.secondStrand = secondStrand; } public int Distance() { return firstStrand.Where((x, i) => x != secondStrand[i]).Count(); } }
Version data entries
115 entries across 115 versions & 1 rubygems