Skip to content

Commit b908387

Browse files
committed
Solved leetcode 461
1 parent c2f15ec commit b908387

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: 461/461.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def hammingDistance(self, x: int, y: int) -> int:
3+
res = 0
4+
while(x or y):
5+
res += x % 2 != y % 2
6+
x = x >> 1
7+
y = y >> 1
8+
9+
return res

0 commit comments

Comments
 (0)