
动态规划
文章平均质量分 50
柯森锎
92年的小学生
展开
-
LeetCode 10. Regular Expression Matching(hard)
题目描述Implement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element.The matching should cover the entire input st原创 2016-09-25 21:22:28 · 371 阅读 · 0 评论 -
LeetCode 44. Wildcard Matching
题目描述Implement wildcard pattern matching with support for ‘?’ and ‘*’.‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching should cover t原创 2016-10-11 20:25:00 · 246 阅读 · 0 评论 -
动态规划解析
参考《算法导论》动态规划章节。 判断一个问题能否用动态规划解决,要求问题满足两个条件: 1)存在最优子结构,即一个问题可以通过n(n>=1)个选择划分成n或n+1个同类子问题+选择代价; 2)存在重叠子问题,不同的问题会重复调用同一个子问题;动态规划解决问题的步骤: 1)刻画一个最优解的结构特征,即寻找一个最优子结构; 2)一个递归求解方案; 3)计算最优解的值,两种方法原创 2016-09-26 23:03:38 · 465 阅读 · 0 评论 -
LeetCode 32. Longest Valid Parentheses(hard)
题目描述Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which原创 2016-09-29 18:59:08 · 352 阅读 · 0 评论