Problem
The Hamming distance between two integers is the number of bit positions where their bits are different. Given x and y, return it.
Example 1
- Input
- x = 1, y = 4
- Output
- 2
- Why
- 001 vs 100: positions 0 and 2 differ
Example 2
- Input
- x = 3, y = 1
- Output
- 1
- Why
- 11 vs 01
Example 3
- Input
- x = 5, y = 5
- Output
- 0
Constraints
0 <= x, y <= 2^31 - 1