Genera Tutte le Stringhe Binarie

Si richiede di creare una funzione ricorsiva che generi tutte le stringhe binarie di lunghezza n.
Le stringhe binarie sono sequenze di 1 e 0. Ad esempio, per n=3, le stringhe binarie sono 000, 001, 010, 011, 100, 101, 110, 111.
L'input del programma è un singolo numero intero n che rappresenta la lunghezza delle stringhe binarie.
L'output del programma dovrebbe essere tutte le stringhe binarie di lunghezza n, ognuna su una nuova riga, in ordine arbitrario.
Ingresso
Uscita
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