Skip to content

Commit 2d1cd0e

Browse files
authored
[Math] Refactor solution to Hamming Distance
1 parent b144b76 commit 2d1cd0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Math/HammingDistance.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class HammingDistance {
1010
var z = x ^ y, count = 0
1111

1212
while z > 0 {
13-
count = z & 1 == 1 ? count + 1 : count
13+
count += z & 1
1414
z = z >> 1
1515
}
1616

1717
return count
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)