Update appNew update is available. Click here to update.

Generate Binary Numbers

Last Updated: 16 Dec, 2020
Difficulty: Easy

PROBLEM STATEMENT

Try Problem

Your friend Ninja has been learning about binary numbers lately. In order to understand binary numbers with perfection, Ninja asks you to generate a list of binary numbers from 1 to ‘N’, which he can use later for reference.

For every integer Ninja gives, your task is to generate all the binary numbers from 1 to ‘N’.

Example:

Consider N = 5,
All the binary numbers from 1 to 5 are: 1, 10, 11, 100, 101.
Input format:
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’.
Output format:
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.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given function.
Constraints:
1 <= T <= 10 
1 <= N <= 10 ^ 5

Time Limit: 1 sec