Generate parentheses
Your task
Generate all well-formed strings of n pairs of parentheses. Return them sorted lexicographically. For n = 0 return a list containing the single empty string. 0 <= n <= 8.
Examples
generate_parentheses(n: int) -> list[str]Example 1
Input
generate_parentheses(3)Output
["((()))", "(()())", "(())()", "()(())", "()()()"]