15 lines
377 B
C#
15 lines
377 B
C#
internal class Hamming {
|
|
public static int Compute(string strand1, string strand2) {
|
|
int ret = 0;
|
|
if(strand1.Length != strand2.Length) {
|
|
throw new System.ArgumentException("Strands must be same length");
|
|
}
|
|
for(int i = 0; i < strand1.Length; i++) {
|
|
if(strand1[i] != strand2[i]) {
|
|
ret++;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
}
|