摘要: dp[i]表示以s[i]结尾的完全匹配的最大字符串的长度。 开始递推 s[i] = ')' 的情况 先想到了两种情况: 1、s[i-1] = '(' 相邻匹配 这种情况下,dp [i] = dp[i-2] + 2。 2、s[i-1] = ')' 这种情况下,第一感觉是要看dp[i-1]的值,即 j. 阅读全文
posted @ 2017-11-21 12:41 newbird2017 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 第一道被我AC的hard题!菜鸡难免激动一下,不要鄙视.. Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parenthese 阅读全文
posted @ 2017-11-21 10:23 newbird2017 阅读(182) 评论(0) 推荐(0) 编辑