Print N-bit binary numbers having more 1’s than 0’s
Submissions: 1183   Accuracy:

34.05%

  Difficulty: Medium   Marks: 4

Given a positive integer N, print all N bit binary numbers having more 1’s than 0’s for any prefix of the number.

Input:
The first line of input contains an integer T, denoting the number of test cases. Then T test cases follow.
Each test case contains an integer N.

Output:
For each test case,
print all N bit binary numbers in decreasing order in a newline.

Constraints:
1<=T<=20
1<=N<=20

Example:
Input:
2

2
3
Output:
11 10
111 110 101

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arun Tyagi
Author: arun03


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.