Given a number N, the task is to find the maximum 0’s between two immediate 1’s in binary representation of given n. Return -1 if binary representation contains less than two 1’s.
Input : N = 47 Output: 1 as binary of N = 47 is 101111 Input : N = 549 Output: 3 as binary of n = 549 is 1000100101 Input : N = 1030 Output: 7 as binary of N = 1030 is 10000000110 Input : N = 8 Output: -1 as there is only one 1 in binary representation of 8.
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer N.
For each test case in a new line print the required result.
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.