Medium · Backtracking
Generate Parentheses
Given an integer n, return every string of n '(' and n ')' characters that is a well-formed (balanced) parentheses sequence, in any order.
Examples
Example 1
n = 3Output: 5 strings
Example 2
n = 2Output: 2 strings
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.