Problem of the day
Consider N = 5,
All the binary numbers from 1 to 5 are: 1, 10, 11, 100, 101.
The very first line of input contains an integer ‘T’ denoting the number of test cases.
The first and the only line of every test case contains a positive integer ‘N’.
For each test case, print ‘N’ space-separated binary numbers from 1 to ‘N’, in a separate line.
Print the output of each test case in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10 ^ 5
Time Limit: 1 sec
2
2
6
1 10
1 10 11 100 101 110
For the first test case when N = 2.
We need all the binary numbers from 1 to 2:
1 -> 1
2 -> 10
Thus, the output is 1, 10.
For the second test case when N = 6
We need all the binary numbers from 1 to 6:
1 -> 1
2 -> 10
3 -> 11
4 -> 100
5 -> 101
6 -> 110
Thus, the output is 1, 10, 11, 100, 101, 110.
2
8
4
1 10 11 100 101 110 111 1000
1 10 11 100