很简单的字符串匹配问题,直接用栈就可以实现,为使程序更加高效,当要匹配的字符种类比较多的时候可以考虑用HashMap来保存匹配对...
分类:
其他好文 时间:
2015-05-21 10:55:47
阅读次数:
100
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:
"((()))", "(()())", "(())()", "()(())", "()()...
分类:
其他好文 时间:
2015-05-20 16:22:27
阅读次数:
92
https://leetcode.com/problems/valid-parentheses/Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if ...
分类:
编程语言 时间:
2015-05-17 18:29:30
阅读次数:
187
https://leetcode.com/problems/longest-valid-parentheses/Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the leng...
分类:
编程语言 时间:
2015-05-16 18:21:36
阅读次数:
289
括号匹配判断,关键思想:利用一个栈来保存前括号,然后有后括号来时弹出栈顶来判断。
分类:
其他好文 时间:
2015-05-14 20:15:48
阅读次数:
167
Problem:
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substri...
分类:
编程语言 时间:
2015-05-14 18:44:41
阅读次数:
121
题目描述:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set i...
分类:
编程语言 时间:
2015-05-14 18:38:58
阅读次数:
131
题目:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the long...
分类:
其他好文 时间:
2015-05-12 20:40:49
阅读次数:
88
有效的括弧匹配注意事项:1 使用stack遇到'(' '[' '{'就push,遇到')' ']' '}'匹配进行pop等操作class Solution {public: bool isValid(string s) { stack mystack; char tmp; for(char c:s....
分类:
其他好文 时间:
2015-05-11 23:43:31
阅读次数:
159
我的错误代码: 1 #include 2 3 using namespace std; 4 5 int longestValidParentheses(string s) 6 { 7 int i = 0; 8 int L = s.length(); 9 int j;10 ...
分类:
其他好文 时间:
2015-05-11 12:54:52
阅读次数:
96