Generate All Binary Strings

Subsequences Pattern DSA practice problem on Onlearn.

Difficulty: medium.

Topics: How can we generate all binary strings of length n?, Recursion, Strings, Time Complexity, Space Complexity, Loops, Bitwise Operations, bit manipulation, binary representation, backtracking, combinatorics, recursion, Bit Manipulation.

Problem Statement Given an integer n, generate and print all possible binary strings of length n in lexicographical order. Input A single integer n (1 <= n <= 10). Output Print each binary string on a new line. Sample Test Cases Sample Input 1 2 Sample Output 1 00 01 10 11 Sample Input 2 1 Sample Output 2 0 1