Flip Bits
Problem
Determine the number of bits required to flip if you want to convert integer n to integer m.
Example
Given n = 31 (11111)
, m = 14 (01110)
, return 2
.
Note
Both n and m are 32-bit integers
Solution
Take XOR of the two numbers, and count how many 1's in it.