


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
The idea is to generate all the decimal numbers from 1 to N and convert each of them to their corresponding binary representation.
This can be done as follows:
The idea is to recognize the pattern while generating the sequence of the binary numbers. The following image can help us identify the pattern easily.
→ The number in blue color represents the decimal form of the binary number present inside the circle: