1.题目
2.思路
3.代码
class Solution
{
public:int left,right;string path;vector<string> ret;vector<string> generateParenthesis(int n) {dfs(n);return ret;}void dfs(int n){if(right==n){ret.push_back(path);return;}if(right<left){path.push_back(')');right++;dfs(n);path.pop_back();right--;}if(left<n){path.push_back('(');left++;dfs(n);path.pop_back();left--;}}
};