Files
OlympiadCode/leetcode_py/461.py
2024-06-20 06:29:07 +08:00

6 lines
157 B
Python

class Solution:
def hammingDistance(self, x: int, y: int) -> int:
x_y = x ^ y
distance = bin(x_y)[2:].count("1")
return distance