摘要: 本来以为没必要用栈,代码如下: class Solution { public: int longestValidParentheses(string s) { int stack = 0; int length=0,max=0; for(int i=0;i<s.length();i++) { if 阅读全文
posted @ 2016-02-03 23:31 你好呵呵 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 这道题和之前的那道Regular Expression Matching有点相似,第一反应是跟之前一样,用递归来做 bool doMatch(char *s,char *p) { if (*p == '\0') return *s == '\0'; if(*p == '*') { while(*s! 阅读全文
posted @ 2016-02-03 23:28 你好呵呵 阅读(490) 评论(0) 推荐(0) 编辑