Determine the number of bits required to flip if you want to convert integer n to integer m.
n = 31 (
m = 14 (
We first use the XOR operator
^ to find the different bits. Then we use the expression
n & (n - 1), which removes the lowest
1 bit. This is called Kernighan’s Bit Counting Algorithm.