38: Hamming distance
Given two unsigned integers x
and y
, calculate the Hamming distance
Example 1
Input: x = 5, y = 5
Output: 0
Example 2
Input: x = 1, y = 3
Output: 1
Helpful article
Given two unsigned integers x
and y
, calculate the Hamming distance
Example 1
Input: x = 5, y = 5
Output: 0
Example 2
Input: x = 1, y = 3
Output: 1