![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
止此耳耳耳
这个作者很懒,什么都没留下…
展开
-
贪心
44:通配符匹配 这道题之前用动态规划的方法做过,此处用贪心重做一遍。 动态规划和贪心算法都是一种递推算法 均有局部最优解来推导全局最优解 不同点: 贪心算法: 1.贪心算法中,作出的每步贪心决策都无法改变,因为贪心策略是由上一步的最优解推导下一步的最优解,而上一部之前的最优解则不作保留。 2.贪心法正确的条件是:每一步的最优解一定包含上一步的最优解。 动态规划算法: 1.全局最优解中一定包含...原创 2019-10-11 22:45:56 · 261 阅读 · 0 评论 -
leetcode 763解题报告
题目: A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representin...原创 2018-11-05 20:34:55 · 152 阅读 · 0 评论 -
动态规划
981:求环形子数组最大和 预备知识: Kadane算法:用于求子数组最大和 伪代码: #Kadane's algorithm ans = cur = None for x in A: cur = x + max(cur, 0) ans = max(ans, cur) return ans method1:邻接数组: 环形数组多了一种情况:区间 [0, i],[j,A.l...原创 2019-09-23 11:53:14 · 187 阅读 · 0 评论