Write a method to return all valid combinations of n-pairs of parentheses.

The method should return an `ArrayList`

of strings, in which each string represents a valid combination of parentheses.

The order of the strings in the ArrayList does not matter.

Examples:

`combParenthesis(2) ==> {"(())","()()"}`

**Note:** Valid combination means that parentheses pairs are not left open. ")()(" is not a valid combination.

Need a **hand?** Try out these hints, one at a time.

You could write a recursive helper method to generate the

`ArrayList`

of `String`

s.

2. **Left:** As long as we have not used up all the left parentheses, we can always insert a left parenthesis.

3. **Right:** We can insert a right parenthesis as long as it wonâ€™t lead to a syntax error. We will get a syntax error if there are more right parentheses than left.

public static ArrayList<String> combParenthesis(int pairs) { }

**C**

**Java**

**Python**