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
Core interview problems are free with a full runner and lessons; Pro opens the complete library.