leetcode 22 Generat Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
1 | [ |
1 | class Solution { |
- Using backtrace method.
left
means the number of(
,right
means the number of)
. Each step, if left < n , this means that we should add(
to current string s , ifright
<left
, this means that we should add)
to current string s.