private static void _generateParenthesis(int left, int right, char[] str, ArrayList<String> results) {
        if (left == 0 && right == 0) {
            results.add(str.toString());
            return;
        }
        int index = str.length - left - right;
        if (left < right) {
            if (left > 0) {
                str[index] = '(';
                _generateParenthesis(left - 1, right, str, results);
            }
            str[index] = ')';
            _generateParenthesis(left, right - 1, str, results);
        }
        else {
            str[index] = '(';
            _generateParenthesis(left - 1, right, str, results);
        }
        return;
    }