Sign in

Finding Hamming Distance

Given two integers x, and y return the number of positions where their values differ in their binary representations as a 32-bit integer.

Example 1



9 in binary is 1001 and 5 in binary is 0101, so indices 2 and 3 are different.