Dashboard
LC #22
Generate Parentheses
Pattern · ?GoogleAmazonMetaBloombergMicrosoft
Problem
Given n pairs of parentheses, generate all combinations of well-formed parentheses.
Constraints
- 1 ≤ n ≤ 8
Example
- Input
- n = 3
- Output
- ["((()))","(()())","(())()","()(())","()()()"]
- Why
- All 5 combinations of 3 pairs of valid parentheses
Spot the pattern
Which pattern cracks it?
Hints
One at a time