461. Hamming Distance
Easy
Problem:
Input: x = 1, y = 4
Output: 2
Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
↑ ↑
The above arrows point to positions where the corresponding bits are different.What to learn:
Number system in Python
>>> bin(87)
'0b1010111'
>>> int('0b1010111', 2)
87
>>> id(87)
4547371104
>>> hex(87)
'0x57'
>>> c = 0x57
>>> c
87
>>> id(c)
4547371104Solution:
Last updated