Given two non-negative integers a and b. The problem is to check whether the two numbers differ at one bit position only or not.
Input : a = 13, b = 9 Output : 1 (13)10 = (1101)2 (9)10 = (1001)2 Both the numbers differ at one bit position only, i.e, differ at the 3rd bit from the right. Input : a = 15, b = 8 Output : 0
INPUT : The first line contains an integer T i.e. the number of test cases.First and last line of each test case consists of two integers n and m.
OUTPUT : If given numbers n and m differ at single bit position then print "1" otherwise print "0".
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.