Print N-bit binary numbers having more 1s than 0s
Medium

Problem Statement

Given a positive integer N, generate all N-digit binary numbers such that for any prefix of the number, the count of 1s is greater than or equal to the count of 0s.

Examples

1Example 1
Input:
{ "N": 3 }
Output:
[ "111", "110", "101" ]
2Example 2
Input:
{ "N": 2 }
Output:
[ "11", "10" ]
3Example 3
Input:
{ "N": 1 }
Output:
[ "1" ]
Loading...

Sign in to Run Code and Submit