Generate All Binary Strings

You are asked to create a recursive function to generate all the binary strings of length n.

Binary strings are sequences of 1's and 0's. For example, for n=3, the binary strings are 000, 001, 010, 011, 100, 101, 110, 111.

The input of the program is a single integer n that represents the length of the binary strings.

The output of the program should be all the binary strings of length n each on a new line in no particular order.

Input

Output

2

00 01 10 11

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue