Easy · Backtracking
Generate Binary Strings
Given an integer n, return all 2^n strings of length n that use only the characters '0' and '1', in any order.
Examples
Example 1
n = 3Output: 8 strings
Example 2
n = 2Output: 4 strings
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.