Please enter your email address or userHandle.
Given a number N. The task is to generate and print all binary numbers with decimal values from 1 to N.
The first line of input contains an integer T denoting the number of test cases. There will be a single line for each testcase which contains N.
Print all binary numbers with decimal values from 1 to N in a single line.
1 ≤ T ≤ 106
1 ≤ N ≤ 106
1 10 11 100 101
Testcase 1: Binary numbers from 1 to 2 are 1 and 10.
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.