Given a number n denoting n pairs of parentheses, return all valid expressions using the n pairs of parentheses.
n: 2
Answer: [
"(())",
"()()",
]
n: 3
Answer: [
"((()))",
"(()())",
"(())()",
"()(())",
"()()()"
]
The first line contains an integer âTâ, denoting the number of test cases.
For each test case, the input has an integer n.
For each test case, the output has multiple lines each denoting a valid parenthesis expression.
3
1
2
3
()
(())
()()
((()))
(()())
(())()
()(())
()()()
1 <= T <= 8
1 <= n <= 8