As reported: DocuSign SDE 2 loop (2026), round 1 coding: Generate Parentheses.
This is LeetCode 22 — Generate Parentheses.
Given n pairs of parentheses, return every string of length 2n made of ( and ) that is well-formed: every opening bracket is closed, and no prefix has more ) than (.
Example 1
n = 3 -> ["((()))","(()())","(())()","()(())","()()()"]
Example 2
n = 1 -> ["()"]
Constraints: 1 ≤ n ≤ 8.
Code runner format: one line holding n. Implement generateParenthesis(n); the strings may be returned in any order (the harness sorts them before printing).