Sha256: 7469c2d53bfcc247f0b4a73c1609cfc7f485d91671b6644bcda5afc31a897522
Contents?: true
Size: 376 Bytes
Versions: 21
Compression:
Stored size: 376 Bytes
Contents
function Get-HammingDifference([string]$strand1, [string]$strand2) { if ( $strand1.length -ne $strand2.length) { Throw "Mismatching string lengths" } $first = [char[]][string]$strand1 $second = [char[]][string]$strand2 $result = 0 for ($i=0; $i -lt $first.length; $i++) { if ( $first[$i] -ne $second[$i] ) { $result += 1 } } return $result }
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
trackler-2.2.1.144 | tracks/powershell/exercises/hamming/hamming-example.ps1 |