Skip to content

Commit 7bb644a

Browse files
committed
feat: solution: easy: hamming-distance.go
1 parent eb63f34 commit 7bb644a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/easy/hamming-distance.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package easy
2+
3+
import "math/bits"
4+
5+
// https://leetcode.com/problems/hamming-distance/
6+
func hammingDistance(x int, y int) int {
7+
return bits.OnesCount(uint(x ^ y))
8+
}

0 commit comments

Comments
 (0)