mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-06 01:14:56 -06:00
11 lines
273 B
PowerShell
11 lines
273 B
PowerShell
function Get-HammingDifference([string]$A, [string]$B) {
|
|
if ($A.Length -ne $B.Length) {
|
|
Throw("Left and right strands must be of equal length.")
|
|
}
|
|
|
|
[int] $hamming = 0
|
|
0..$A.Length | % { if ($A[$_] -ne $B[$_]) { $hamming++ } }
|
|
|
|
return $hamming
|
|
}
|