Generate Parentheses

Given n pairs of parentheses, generate all combinations of well-formed parentheses.

Constraints

  • 1 <= n <= 8
Saving… · 3 lines
class Solution:
def generateParentheses(self, n: int) -> List[str]:

Console

Click Run to execute sample tests.