private static void addParens(int leftNum, int rightNum, char[] chars, int i, ArrayList<String> parens) {
        if (leftNum == 0 && rightNum == 0) {
            parens.add(new String(chars));
        }
        if (leftNum > 0) {
            chars[i] = '(';
            addParens(leftNum - 1, rightNum, chars, i + 1, parens);
        }
        if (rightNum > leftNum) {
            chars[i] = ')';
            addParens(leftNum, rightNum - 1, chars, i + 1, parens);
        }
    }