BETA

Difficulty Level:

Basic

Total Submissions: 1083 Accuracy:

65.56%

Rightmost different bit
     

Given two numbers M and N. Write a program to find the position of rightmost different bit in binary representation of numbers.

Input:
First line of input contains a single integer T which denotes the number of test cases. T test cases follows. First line of each test case contains two space separated integers M and N.

Output:
For each test case print the position of rightmost different bit in binary representation of numbers. If both M and N are same then print -1 in this case.

Constraints:
1<=T<=100
1<=M<=1000
1<=N<=1000

Example:
Input:
2
11 9
52 4
Output:
2
5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.