Please enter your email address or userHandle.
Given an integer n in the input, find its next sparse binary number.A sparse binary number is a number whose binary representation does not contain any consecutive 1s.
The first line of input contains an integer T denoting the number of test cases. The first line of each test case is number 'N'
Print next Sparse binary number,if the input number is not sparse else print the number itself.
1 ≤ T ≤ 100
1 ≤ n ≤ 100000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.