![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode刷题积累
muz1lee
这个作者很懒,什么都没留下…
展开
-
Dynamic programming
分类 每个阶段只有一个状态 : 递归 每个阶段的最优状态都是由上一个阶段的最优状态得到的: 贪心 每个阶段的最优状态由之前所有阶段的状态的组合得到的: 搜索 每个阶段的最优状态可以从之前某个阶段的某个或某些状态直接得到而不管之前这个状态是如何得到的 : 动态规划 特点 最优子结构: 问题的最优解所包含的子问题的解也是最优的。 子问题重叠: 对每个子问题只计算一次,然后将计算结果保存在一个表格中。 无后效性:某状态以后的过程不会影响以前的状态 三要素 问题的阶段 每个阶段的状态 从前一阶段转化到后一原创 2020-12-29 13:50:43 · 99 阅读 · 0 评论 -
Two Pointer Method
Two Pointer Method Leetcode 925 Long Pressed Name Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times. You examine the typed characters of t原创 2020-12-27 02:29:38 · 155 阅读 · 0 评论 -
Leetcode 349/350 :Intersection of Two Arrays I&II
Python set 函数 , Leetcode 349My solutionOther solutions set() 函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。 Leetcode: 349. Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Input: nums1 = [1,2,2,1], nums2 = [2,2]原创 2020-12-23 12:57:37 · 141 阅读 · 0 评论