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

Version Path
trackler-2.0.8.14 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.13 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.12 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.11 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.10 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.9 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.8 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.7 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.6 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.5 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.4 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.3 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.2 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.8.1 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.7.0 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.6.44 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.6.43 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.6.42 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.6.41 tracks/csharp/exercises/hamming/Example.cs
trackler-2.0.6.40 tracks/csharp/exercises/hamming/Example.cs