Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n pairs of parentheses.

Note: The result set should not contain duplicated subsets.

For example, given n = 3, the result should be:

[
  "((()))",
  "(()())",
  "(())()",
  "()(())",
  "()()()"
]