@@ -0,0 +1,824 @@
+package generateParentheses;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Solution %7B%0A    public List%3CString%3E generateParenthesis(int n) %7B%0A        int left = n, right = n;%0A        List%3CString%3E res = new ArrayList%3CString%3E();%0A        help(res, new StringBuilder(), left, right);%0A        return res;%0A    %7D%0A    %0A    public void help(List%3CString%3E res, StringBuilder sb, int left, int right)%7B%0A        if(left %3E right %7C%7C left %3C 0 %7C%7C right %3C 0) return;%0A        if(left == 0 && right == 0)%7B%0A            res.add(sb.toString());%0A            return ;%0A        %7D%0A        %0A        StringBuilder sb1 = new StringBuilder(sb);%0A        sb1.append('(');%0A        help(res, sb1, left-1, right);%0A        %0A        StringBuilder sb2 = new StringBuilder(sb);%0A        sb2.append(')');%0A        help(res, sb2, left, right-1);%0A    %7D%0A%7D

generate parentheses -- recursive