LeetCode 刷题记录: 22. Generate Parentheses [Python]

原题

https://leetcode.com/problems/generate-parentheses/

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

思路

使用动态规划,分析子问题:每次加括号要么加在外面,要么加在旁边。

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×