Number of Mismatching Bits
Determine the number of bits that differ between the binary representations of two given integers "first" and "second".
Input:
The input starts with an integer ‘T’ representing the number of test cases.
Each of the following ‘T’ lines contains two space-separated integers, "first" and "second".
Output:
For each test case, output a single integer on a new line representing the number of mismatched bits in the binary representation of the two integers.
Example:
Input:
3
11 15
23 56
10 20
Output:
1
4
4
Constraints:
- 1 <= T <= 105
- 0 <= first, second <= 109
Note:
Remember not to print anything; just implement the function to return the number of mismatching bits for the given pairs of numbers.
Be the first one to answer
Add answer anonymously...
Popular interview questions of Intern
Top HR questions asked in Wells Fargo Intern
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app