Generate Parentheses

Given n pairs of parentheses, return all combinations of well-formed parentheses. The result must be in lexicographic order, which is the natural order produced by trying ( before ).

Examples
Input: 3
Output: ["((()))","(()())","(())()","()(())","()()()"]
Hints

Generate Parentheses

Given `n` pairs of parentheses, return all combinations of well-formed parentheses. The result must be in lexicographic order, which is the natural order produced by trying `(` before `)`.