Given two integers N and M. The task is to find the longest contiguous subset in binary representation of both the numbers and print its decimal value.
Note: If there are two or more longest common substrings with the same length, the print the maximum value of all the common substrings.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two integer N and M as input.
For each test case, print the decimal value of longest common substring In new line.
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.