[22] Generate Parentheses
https://leetcode.com/problems/generate-parentheses/description/
- algorithms
- Medium (50.13%)
- Source Code: 22.generate-parentheses.py
- Total Accepted: 245.2K
- Total Submissions: 489K
- Testcase Example: '3'
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:
[ "((()))", "(()())", "(())()", "()(())", "()()()" ]
python
class Solution(object):
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""