Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Monday, October 6, 2014
Generate Parentheses
Problem
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:
"((()))", "(()())", "(())()", "()(())", "()()()"
Idea
dfs暴力搜索,解的长度为2n,当找到2n长的一个solution后判断其是否valid
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment