Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def hammingDistance(self, x, y):
- """
- :type x: int
- :type y: int
- :rtype: int
- """
- z = x ^ y
- res = 0
- while z > 0:
- z &= z - 1
- res += 1
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement