Generate ParenthesesMedium

string backtracking recursion

Generate all combinations of n pairs of well-formed parentheses. Build each string one character at a time, pruning any prefix that can never become valid.

Press play to watch the algorithm run.
Metrics
Legend
How it works
0 / 0