mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
更新 修复代码随想录算法公开课链接
This commit is contained in:
@ -444,4 +444,3 @@ public class Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -27,16 +27,16 @@
|
|||||||
当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
|
当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
|
||||||
对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与C语言的 strstr() 以及 Java的 indexOf() 定义相符。
|
对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与C语言的 strstr() 以及 Java的 indexOf() 定义相符。
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
## 思路
|
本题是KMP 经典题目。以下文字如果看不进去,可以看[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html),相信结合视频再看本篇题解,更有助于大家对本题的理解。
|
||||||
|
|
||||||
本题是KMP 经典题目。
|
|
||||||
|
|
||||||
以下文字如果看不进去,可以看我的B站视频:
|
|
||||||
|
|
||||||
* [帮你把KMP算法学个通透!B站(理论篇)](https://www.bilibili.com/video/BV1PD4y1o7nd/)
|
* [帮你把KMP算法学个通透!B站(理论篇)](https://www.bilibili.com/video/BV1PD4y1o7nd/)
|
||||||
* [帮你把KMP算法学个通透!(求next数组代码篇)](https://www.bilibili.com/video/BV1M5411j7Xx)
|
* [帮你把KMP算法学个通透!(求next数组代码篇)](https://www.bilibili.com/video/BV1M5411j7Xx)
|
||||||
|
|
||||||
|
|
||||||
|
## 思路
|
||||||
|
|
||||||
KMP的经典思想就是:**当出现字符串不匹配时,可以记录一部分之前已经匹配的文本内容,利用这些信息避免从头再去做匹配。**
|
KMP的经典思想就是:**当出现字符串不匹配时,可以记录一部分之前已经匹配的文本内容,利用这些信息避免从头再去做匹配。**
|
||||||
|
|
||||||
本篇将以如下顺序来讲解KMP,
|
本篇将以如下顺序来讲解KMP,
|
||||||
@ -1362,3 +1362,4 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
* 输入:height = [4,2,0,3,2,5]
|
* 输入:height = [4,2,0,3,2,5]
|
||||||
* 输出:9
|
* 输出:9
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[单调栈,经典来袭!LeetCode:42.接雨水](https://www.bilibili.com/video/BV1uD4y1u75P/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
@ -1029,4 +1033,3 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -469,4 +469,3 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -744,4 +744,3 @@ end
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -559,3 +559,4 @@ public class Solution
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -739,3 +739,4 @@ object Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
* 1 <= heights.length <=10^5
|
* 1 <= heights.length <=10^5
|
||||||
* 0 <= heights[i] <= 10^4
|
* 0 <= heights[i] <= 10^4
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[单调栈,又一次经典来袭! LeetCode:84.柱状图中最大的矩形](https://www.bilibili.com/video/BV1Ns4y1o7uB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
本题和[42. 接雨水](https://programmercarl.com/0042.接雨水.html),是遥相呼应的两道题目,建议都要仔细做一做,原理上有很多相同的地方,但细节上又有差异,更可以加深对单调栈的理解!
|
本题和[42. 接雨水](https://programmercarl.com/0042.接雨水.html),是遥相呼应的两道题目,建议都要仔细做一做,原理上有很多相同的地方,但细节上又有差异,更可以加深对单调栈的理解!
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
* 0 <= s.length, t.length <= 1000
|
* 0 <= s.length, t.length <= 1000
|
||||||
* s 和 t 由英文字母组成
|
* s 和 t 由英文字母组成
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划之子序列,为了编辑距离做铺垫 | LeetCode:115.不同的子序列](https://www.bilibili.com/video/BV1fG4y1m75Q/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
|
@ -563,4 +563,3 @@ public class Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<p align="center"><strong><a href="https://mp.weixin.qq.com/s/tqCxrMEU-ajQumL1i8im9A">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
|
<p align="center"><strong><a href="https://mp.weixin.qq.com/s/tqCxrMEU-ajQumL1i8im9A">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
|
||||||
|
|
||||||
|
|
||||||
# 416. 分割等和子集
|
# 416. 分割等和子集
|
||||||
|
|
||||||
[力扣题目链接](https://leetcode.cn/problems/partition-equal-subset-sum/)
|
[力扣题目链接](https://leetcode.cn/problems/partition-equal-subset-sum/)
|
||||||
@ -730,3 +731,4 @@ object Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位
|
|||||||
* nums1和nums2中所有整数 互不相同
|
* nums1和nums2中所有整数 互不相同
|
||||||
* nums1 中的所有整数同样出现在 nums2 中
|
* nums1 中的所有整数同样出现在 nums2 中
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[单调栈,套上一个壳子就有点绕了| LeetCode:496.下一个更大元素](https://www.bilibili.com/video/BV1jA411m7dX/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
做本题之前,建议先做一下[739. 每日温度](https://programmercarl.com/0739.每日温度.html)
|
做本题之前,建议先做一下[739. 每日温度](https://programmercarl.com/0739.每日温度.html)
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
* 1 <= nums.length <= 10^4
|
* 1 <= nums.length <= 10^4
|
||||||
* -10^9 <= nums[i] <= 10^9
|
* -10^9 <= nums[i] <= 10^9
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[单调栈,成环了可怎么办?LeetCode:503.下一个更大元素II](https://www.bilibili.com/video/BV15y4y1o7Dw/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
@ -294,3 +298,4 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
* 1 <= s.length <= 1000
|
* 1 <= s.length <= 1000
|
||||||
* s 只包含小写英文字母
|
* s 只包含小写英文字母
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划再显神通,LeetCode:516.最长回文子序列](https://www.bilibili.com/video/BV1d8411K7W6/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
提示:输入的字符串长度不会超过 1000 。
|
提示:输入的字符串长度不会超过 1000 。
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划,字符串性质决定了DP数组的定义 | LeetCode:647.回文子串](https://www.bilibili.com/video/BV17G4y1y7z9/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
### 暴力解法
|
### 暴力解法
|
||||||
@ -528,4 +532,3 @@ function expandRange(s: string, left: number, right: number): number {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -697,4 +697,3 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
提示:气温 列表长度的范围是 [1, 30000]。每个气温的值的均为华氏度,都是在 [30, 100] 范围内的整数。
|
提示:气温 列表长度的范围是 [1, 30000]。每个气温的值的均为华氏度,都是在 [30, 100] 范围内的整数。
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[单调栈,你该了解的,这里都讲了!LeetCode:739.每日温度](https://www.bilibili.com/video/BV1my4y1Z7jj/),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
|
|
||||||
|
@ -163,4 +163,3 @@
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -128,4 +128,3 @@ KMP算法是字符串查找最重要的算法,但彻底理解KMP并不容易
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
<img src='https://code-thinking-1253855093.file.myqcloud.com/pics/20210917104315.png' width=600 alt='贪心算法大纲'> </img></div>
|
<img src='https://code-thinking-1253855093.file.myqcloud.com/pics/20210917104315.png' width=600 alt='贪心算法大纲'> </img></div>
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[贪心算法理论基础!](https://www.bilibili.com/video/BV1WK4y1R71x/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 什么是贪心
|
## 什么是贪心
|
||||||
|
|
||||||
|
@ -508,4 +508,3 @@ object Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user