title: leetcode Generate Parentheses Algorithm
body: <p>I am doing a leetcode algorithm, <a href="https://leetcode.com/problems/generate-parentheses/" rel="nofollow">link</a>. </p>
  
  <pre><code>Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
  
  For example, given n = 3, a solution set is:
  
  [
    "((()))",
    "(()())",
    "(())()",
    "()(())",
    "()()()"
  ]
  </code></pre>
  
  <p>I totally have no idea about that.</p>
  
  <p>I do know the number of combination equals to catalan number</p>
  
  <p>but I don't know how to list all the combinations</p>
  
  <p>anyone could give me some hints ? even no code will be good for me</p>