135: Generate parentheses

Given number pairs of parentheses, return all combinations of well-formed parentheses

 

Example 1

Input:   2

Output:  ["(())", "()()"]

Example 2

Input:   3

Output:  ["((()))", "(()())", "(())()", "()(())", "()()()"]
Difficulty:Medium
Topic:Backtracking
Problem #:135