6 lines
157 B
Python
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
|