画出所有情况
class Solution {
public List<String> generateParenthesis(int n) {
List<String> result = new ArrayList();
back(result,"",0,0,n);
return result;
}
public void back(List<String> result,String cur,int open,int close,int max){
if(cur.length()==max*2){
result.add(cur);
return;
}
if(open<max){
back(result,cur+"(",open+1,close,max);
}
if(close<open){
back(result,cur+")",open,close+1,max);
}
}
}