Count number of bits to be flipped to convert A to B
Problem
You are given two numbers A and B. Write a function to determine the number of bits need to be flipped to convert integer A to integer B.
Example
Input: 73, 21 Output: 4 Representing numbers in bits : A = 1001001 B = 0010101 C = \* \*\*\* C = 4 Solution
Method 1 - Counting the bits set after XORing 2 numbers
1. Calculate XOR of A and B.
[Read More]