今天店面也考了这道
Given a String str
remove minimal number of "("
and ")"
to make the string valid.
For example:
Given string "(a))"
, you should output "(a)"
其实是 https://leetcode.com/problems/remove-invalid-parentheses/ 简化版
今天店面也考了这道
Given a String str
remove minimal number of "("
and ")"
to make the string valid.
For example:
Given string "(a))"
, you should output "(a)"
其实是 https://leetcode.com/problems/remove-invalid-parentheses/ 简化版
为什么bfs不让过?
bfs不是最优解,runtime 上比dfs差好多