diff --git a/README.md b/README.md index 0ab8612a0c978362c3cef9b9720d5f059a174698..3fd3f6fcd6baea0e1cd69f722bb2d0f036e3fcba 100644 --- a/README.md +++ b/README.md @@ -210,12 +210,12 @@ Gitee Pages 地址:https://labuladong.gitee.io/algo/ * [如何用 BFS 算法秒杀各种智力题](https://labuladong.github.io/article/fname.html?fname=BFS解决滑动拼图) * [数学运算技巧](https://labuladong.github.io/algo/) + * [谈谈游戏中的随机算法](https://labuladong.github.io/article/fname.html?fname=随机算法) * [常用的位操作](https://labuladong.github.io/article/fname.html?fname=常用的位操作) * [讲两道常考的阶乘算法题](https://labuladong.github.io/article/fname.html?fname=阶乘题目) * [如何高效寻找素数](https://labuladong.github.io/article/fname.html?fname=打印素数) * [如何高效进行模幂运算](https://labuladong.github.io/article/fname.html?fname=superPower) * [如何同时寻找缺失和重复的元素](https://labuladong.github.io/article/fname.html?fname=缺失和重复的元素) - * [如何在无限序列中随机抽取元素](https://labuladong.github.io/article/fname.html?fname=水塘抽样) * [一行代码就能解决的算法题](https://labuladong.github.io/article/fname.html?fname=一行代码解决的智力题) * [几个反直觉的概率问题](https://labuladong.github.io/article/fname.html?fname=几个反直觉的概率问题) @@ -240,6 +240,8 @@ Gitee Pages 地址:https://labuladong.gitee.io/algo/ * [Linux shell 的实用小技巧](https://labuladong.github.io/article/fname.html?fname=linuxshell技巧) * [Linux 管道符原理大揭秘](https://labuladong.github.io/article/fname.html?fname=linux技巧3) * [一文看懂 session 和 cookie](https://labuladong.github.io/article/fname.html?fname=session和cookie) + * [消息队列架构设计演进](https://labuladong.github.io/article/fname.html?fname=消息队列) + * [存储系统设计之 LSM 树原理](https://labuladong.github.io/article/fname.html?fname=LSM树) * [加密算法的前身今世](https://labuladong.github.io/article/fname.html?fname=密码技术) * [我用四个命令概括了 Git 的所有套路](https://labuladong.github.io/article/fname.html?fname=git常用命令) * [Git/SQL/正则表达式的在线练习平台](https://labuladong.github.io/article/fname.html?fname=在线练习平台) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/LCS.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/LCS.md" index db7a3cc79a62228eec28e88e39686a5c9b004285..5666c7aa2179221b991d0ab5c38252efdde0fb71 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/LCS.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/LCS.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213KMP\345\255\227\347\254\246\345\214\271\351\205\215\347\256\227\346\263\225.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213KMP\345\255\227\347\254\246\345\214\271\351\205\215\347\256\227\346\263\225.md" index b5856dd9251c85403b63723310b7ad6f0ec9d6c5..35c321adea0926a18e85d27dbf12b956bd8d457e 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213KMP\345\255\227\347\254\246\345\214\271\351\205\215\347\256\227\346\263\225.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213KMP\345\255\227\347\254\246\345\214\271\351\205\215\347\256\227\346\263\225.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -438,7 +438,7 @@ KMP 算法也就是动态规划那点事,我们的公众号文章目录有一 **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\215\232\345\274\210\351\227\256\351\242\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\215\232\345\274\210\351\227\256\351\242\230.md" index 53845c768175bbd132861ed0d14f07aaea01ce88..986af5ef9d5efb9d5fb57606e3f35df3f56d3b2c 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\215\232\345\274\210\351\227\256\351\242\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\215\232\345\274\210\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -240,7 +240,7 @@ int stoneGame(int[] piles) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\233\233\351\224\256\351\224\256\347\233\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\233\233\351\224\256\351\224\256\347\233\230.md" index 96296df8a39738c7a601006e7e2834be777b9819..f4fb2eda63e706b34274b6103cac12dd2fd4e5d1 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\233\233\351\224\256\351\224\256\347\233\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\345\233\233\351\224\256\351\224\256\347\233\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -230,7 +230,7 @@ def dp(n, a_num, copy): **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\346\255\243\345\210\231\350\241\250\350\276\276.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\346\255\243\345\210\231\350\241\250\350\276\276.md" index 3d06fde8b2fab91415d3165f69c2b41ac76fa3a1..31701f2bb8c6c4d1c1b9c682d31d8caff9ea5930 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\346\255\243\345\210\231\350\241\250\350\276\276.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\344\271\213\346\255\243\345\210\231\350\241\250\350\276\276.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\256\276\350\256\241\357\274\232\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\256\276\350\256\241\357\274\232\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" index d13b0064831afa34f15e94625a14a70141f3f24c..ad741d36a216f117b6ebce21bc5973b6925a146a 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\256\276\350\256\241\357\274\232\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\256\276\350\256\241\357\274\232\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -327,7 +327,7 @@ int lengthOfLIS(int[] nums) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\257\246\350\247\243\350\277\233\351\230\266.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\257\246\350\247\243\350\277\233\351\230\266.md" index acc1ff58e77c197344b65d44f5d972b107c76cca..821b3ae02ddbdc285a4d8cb620b04262f912154e 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\257\246\350\247\243\350\277\233\351\230\266.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\212\250\346\200\201\350\247\204\345\210\222\350\257\246\350\247\243\350\277\233\351\230\266.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -496,7 +496,7 @@ int coinChange(int[] coins, int amount) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\215\225\350\257\215\346\213\274\346\216\245.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\215\225\350\257\215\346\213\274\346\216\245.md" index a47d1a794fd5fe3f419a93ea1d8c100cbf406484..39b34032babcde4bf9b5c25a3b8767d495fb6e74 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\215\225\350\257\215\346\213\274\346\216\245.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\215\225\350\257\215\346\213\274\346\216\245.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -445,6 +445,6 @@ List dp(String s, int i) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\233\242\347\201\255\350\202\241\347\245\250\351\227\256\351\242\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\233\242\347\201\255\350\202\241\347\245\250\351\227\256\351\242\230.md" index 163d977cbf165575b10470fbc1a9b7abd2be517f..d607c68ca81ba046d262b0f60994282d94322e86 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\233\242\347\201\255\350\202\241\347\245\250\351\227\256\351\242\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\233\242\347\201\255\350\202\241\347\245\250\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -709,6 +709,6 @@ int maxProfit_k_inf(int[] prices, int cooldown, int fee) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\255\220\345\272\217\345\210\227\351\227\256\351\242\230\346\250\241\346\235\277.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\255\220\345\272\217\345\210\227\351\227\256\351\242\230\346\250\241\346\235\277.md" index a6241a76c82d096cacb65193afae16a7792a158f..c20300a3350f0f4fcf21196a8c9919bbad791869 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\255\220\345\272\217\345\210\227\351\227\256\351\242\230\346\250\241\346\235\277.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\345\255\220\345\272\217\345\210\227\351\227\256\351\242\230\346\250\241\346\235\277.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\212\242\346\210\277\345\255\220.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\212\242\346\210\277\345\255\220.md" index 9c394b5352adf02737f5ba9681d4c095bf64f145..5a00974f2c829cbac858a97156a86553cb95e7a5 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\212\242\346\210\277\345\255\220.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\212\242\346\210\277\345\255\220.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\234\200\344\274\230\345\255\220\347\273\223\346\236\204.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\234\200\344\274\230\345\255\220\347\273\223\346\236\204.md" index b1b789de6204e3ed32d290f92ad293c5a61e43cb..ec0990825dce78d0e0172c49c8d7a3796e306446 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\234\200\344\274\230\345\255\220\347\273\223\346\236\204.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\346\234\200\344\274\230\345\255\220\347\273\223\346\236\204.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -180,13 +180,12 @@ bool dp(string& s, int i, string& p, int j) { dp(s, i, p, j + 2); // #1 dp(s, i + 1, p, j); // #2 dp(s, i + 1, p, j + 1); // #3 - dp(s, i, p, j + 2); // #4 } ``` 和上一题一样,这个解法的「状态」也是 `(i, j)` 的值,那么我继续问你问题:如果我想从状态 `(i, j)` 转移到 `(i+2, j+2)`,有几种路径? -显然,至少有两条路径:`(i, j) -> #1 -> #4` 和 `(i, j) -> #3 -> #3`。 +显然,至少有两条路径:`(i, j) -> #1 -> #2 -> #2` 和 `(i, j) -> #3 -> #3`,这就说明这个解法存在巨量重叠子问题。 所以,不用画图就知道这个解法也存在重叠子问题,需要用备忘录技巧去优化。 @@ -377,7 +376,7 @@ for (int i = 1; i < m; i++) **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\212\266\346\200\201\345\216\213\347\274\251\346\212\200\345\267\247.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\212\266\346\200\201\345\216\213\347\274\251\346\212\200\345\267\247.md" index 7156753663ea65ef4e90705ad0e13067a54c16cf..57ffe82eed3e6b8e7702a79743cd935f28908b06 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\212\266\346\200\201\345\216\213\347\274\251\346\212\200\345\267\247.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\212\266\346\200\201\345\216\213\347\274\251\346\212\200\345\267\247.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -245,6 +245,6 @@ int longestPalindromeSubseq(string s) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\274\226\350\276\221\350\267\235\347\246\273.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\274\226\350\276\221\350\267\235\347\246\273.md" index 380abfd742ed04246c7ddd43b623d080261afba6..40837b81f855f56088cb943b356382009fafd5cc 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\274\226\350\276\221\350\267\235\347\246\273.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\347\274\226\350\276\221\350\267\235\347\246\273.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -356,7 +356,7 @@ class Node { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\203\214\345\214\205\351\227\256\351\242\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\203\214\345\214\205\351\227\256\351\242\230.md" index df66536d53c0d3dbd886d0957b641bf1766971a6..808d3db392ac67a9708ca5b1763fe892df6ebd76 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\203\214\345\214\205\351\227\256\351\242\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\203\214\345\214\205\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -124,6 +124,7 @@ return dp[N][W] ```java int knapsack(int W, int N, int[] wt, int[] val) { + assert N == wt.length; // base case 已初始化 int[][] dp = new int[N + 1][W + 1]; for (int i = 1; i <= N; i++) { @@ -145,6 +146,8 @@ int knapsack(int W, int N, int[] wt, int[] val) { } ``` +> PS:其实函数签名中的物品数量 `N` 就是 `wt` 数组的长度,所以实际上这个参数 `N` 是多此一举的。但为了体现原汁原味的 0-1 背包问题,我就带上这个参数 `N` 了,你自己写的话可以省略。 + 至此,背包问题就解决了,相比而言,我觉得这是比较简单的动态规划问题,因为状态转移的推导比较自然,基本上你明确了 `dp` 数组的定义,就可以理所当然地确定状态转移了。 接下来可阅读: @@ -171,6 +174,6 @@ int knapsack(int W, int N, int[] wt, int[] val) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\264\252\345\277\203\347\256\227\346\263\225\344\271\213\345\214\272\351\227\264\350\260\203\345\272\246\351\227\256\351\242\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\264\252\345\277\203\347\256\227\346\263\225\344\271\213\345\214\272\351\227\264\350\260\203\345\272\246\351\227\256\351\242\230.md" index 7a597abb8b2e8d212754fead6c61b2a077a32c06..403230912d66219a393cea06fe273139bd861faa 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\264\252\345\277\203\347\256\227\346\263\225\344\271\213\345\214\272\351\227\264\350\260\203\345\272\246\351\227\256\351\242\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\350\264\252\345\277\203\347\256\227\346\263\225\344\271\213\345\214\272\351\227\264\350\260\203\345\272\246\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -184,7 +184,7 @@ int findMinArrowShots(int[][] intvs) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\253\230\346\245\274\346\211\224\351\270\241\350\233\213\351\227\256\351\242\230.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\253\230\346\245\274\346\211\224\351\270\241\350\233\213\351\227\256\351\242\230.md" index da6175a2d7329921fbcb116d0e9c3ddba1c3e213..0dc912756a66013e90f4bc269084e7c8cf544091 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\253\230\346\245\274\346\211\224\351\270\241\350\233\213\351\227\256\351\242\230.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\253\230\346\245\274\346\211\224\351\270\241\350\233\213\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\255\224\345\241\224.md" "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\255\224\345\241\224.md" index 2bb05dc86e31dfb05672c20813315a6c69355271..0f0bcde9d4f37da8d53c24c1b5d9ec17a0401050 100644 --- "a/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\255\224\345\241\224.md" +++ "b/\345\212\250\346\200\201\350\247\204\345\210\222\347\263\273\345\210\227/\351\255\224\345\241\224.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -33,7 +33,7 @@ 输入一个存储着整数的二维数组 `grid`,如果 `grid[i][j] > 0`,说明这个格子装着血瓶,经过它可以增加对应的生命值;如果 `grid[i][j] == 0`,则这是一个空格子,经过它不会发生任何事情;如果 `grid[i][j] < 0`,说明这个格子有怪物,经过它会损失对应的生命值。 -现在你是一名骑士,将会出现在最上角,公主被困在最右下角,你只能向右和向下移动,请问你初始至少需要多少生命值才能成功救出公主? +现在你是一名骑士,将会出现在最左上角,公主被困在最右下角,你只能向右和向下移动,请问你初始至少需要多少生命值才能成功救出公主? **换句话说,就是问你至少需要多少初始生命值,能够让骑士从最左上角移动到最右下角,且任何时候生命值都要大于 0**。 @@ -249,6 +249,6 @@ int dp(int[][] grid, int i, int j) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/linuxshell.md" "b/\346\212\200\346\234\257/linuxshell.md" index beb3c53fbf6b724a9a2afe16300a3af8c3fb9c80..f3d10399d9c3f674d66f5d986dcf13907842f530 100644 --- "a/\346\212\200\346\234\257/linuxshell.md" +++ "b/\346\212\200\346\234\257/linuxshell.md" @@ -1,9 +1,5 @@ # 关于 Linux shell 你必须知道的技巧 - - - -

GitHub @@ -13,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -150,6 +146,20 @@ $ where connect.sh $ sudo /home/fdl/bin/connect.sh ``` + + +


+
+引用本文的文章 + + - [Linux 管道符原理大揭秘](https://labuladong.github.io/article/fname.html?fname=linux技巧3) + +

+ + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\212\200\346\234\257/linux\350\277\233\347\250\213.md" "b/\346\212\200\346\234\257/linux\350\277\233\347\250\213.md" index ac4b45b9149c8184e957a8de30a2ffc28facae2e..7c5f4380b9e256a3afc44eaa449ab03b28c8273c 100644 --- "a/\346\212\200\346\234\257/linux\350\277\233\347\250\213.md" +++ "b/\346\212\200\346\234\257/linux\350\277\233\347\250\213.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -148,7 +148,7 @@ $ cmd1 | cmd2 | cmd3 **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/redis\345\205\245\344\276\265.md" "b/\346\212\200\346\234\257/redis\345\205\245\344\276\265.md" index 1561cf836347a4db111a093a3a93a7bdb135eb9e..a7680d4c7a674fd6bec505056fcd2a7c666f841c 100644 --- "a/\346\212\200\346\234\257/redis\345\205\245\344\276\265.md" +++ "b/\346\212\200\346\234\257/redis\345\205\245\344\276\265.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -101,7 +101,7 @@ Redis 监听的默认端口是 6379,我们设置它接收网卡 127.0.0.1 的 **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/session\345\222\214cookie.md" "b/\346\212\200\346\234\257/session\345\222\214cookie.md" index 7216b772ec63d382400353b348b97e236014d5a3..47a6944d56c785b5d899c2d65b47010d4f72db46 100644 --- "a/\346\212\200\346\234\257/session\345\222\214cookie.md" +++ "b/\346\212\200\346\234\257/session\345\222\214cookie.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -148,7 +148,7 @@ https://github.com/astaxie/build-web-application-with-golang **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/\345\210\267\351\242\230\346\212\200\345\267\247.md" "b/\346\212\200\346\234\257/\345\210\267\351\242\230\346\212\200\345\267\247.md" index 9ad6d47fbe0b52464da82893dad6425cd263d732..f1a41e0cc55231bfe4a8a41e16a6954496ece1fb 100644 --- "a/\346\212\200\346\234\257/\345\210\267\351\242\230\346\212\200\345\267\247.md" +++ "b/\346\212\200\346\234\257/\345\210\267\351\242\230\346\212\200\345\267\247.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -277,6 +277,6 @@ int dp(string& ring, int i, string& key, int j) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/\345\234\250\347\272\277\347\273\203\344\271\240\345\271\263\345\217\260.md" "b/\346\212\200\346\234\257/\345\234\250\347\272\277\347\273\203\344\271\240\345\271\263\345\217\260.md" index 3216bb6a99ae0afb2709ce96e7c9164d98eaa486..dd11c3b6b9be820536d4c6e8a310066af519d72e 100644 --- "a/\346\212\200\346\234\257/\345\234\250\347\272\277\347\273\203\344\271\240\345\271\263\345\217\260.md" +++ "b/\346\212\200\346\234\257/\345\234\250\347\272\277\347\273\203\344\271\240\345\271\263\345\217\260.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -123,7 +123,7 @@ https://sqlzoo.net/ **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\212\200\346\234\257/\345\257\206\347\240\201\346\212\200\346\234\257.md" "b/\346\212\200\346\234\257/\345\257\206\347\240\201\346\212\200\346\234\257.md" index c7f08f22722f37478c2f88cd920ae8e1272d7bd6..d5eb01189809e572bf74d38d2ce8d1b193e35619 100644 --- "a/\346\212\200\346\234\257/\345\257\206\347\240\201\346\212\200\346\234\257.md" +++ "b/\346\212\200\346\234\257/\345\257\206\347\240\201\346\212\200\346\234\257.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -197,7 +197,7 @@ HTTPS 协议中的 SSL/TLS 安全层会组合使用以上几种加密方式,** **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST1.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST1.md" index 4e15c9fd8cc9d10f6cf848a0244cdaa8fbeafd59..f39167651d25565e388908c19676ccab4f97a2a9 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST1.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST1.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -24,6 +24,8 @@ **-----------** +> 本文有视频版:[动手实现 TreeMap](https://appktavsiei5995.pc.xiaoe-tech.com/detail/p_62655516e4b0cedf38a93758/6) + PS:[刷题插件](https://mp.weixin.qq.com/s/OE1zPVPj0V2o82N4HtLQbw) 集成了手把手刷二叉树功能,按照公式和套路讲解了 150 道二叉树题目,可手把手带你刷完二叉树分类的题目,迅速掌握递归思维。 前文手把手带你刷二叉树已经写了 [第一期](https://labuladong.github.io/article/fname.html?fname=二叉树系列1),[第二期](https://labuladong.github.io/article/fname.html?fname=二叉树系列2) 和 [第三期](https://labuladong.github.io/article/fname.html?fname=二叉树系列3),今天写一篇二叉搜索树(Binary Search Tree,后文简写 BST)相关的文章,手把手带你刷 BST。 @@ -215,7 +217,7 @@ void traverse(TreeNode root) { 简单总结下吧,BST 相关的问题,要么利用 BST 左小右大的特性提升算法效率,要么利用中序遍历的特性满足题目的要求,也就这么些事儿吧。 -最后调查下,经过这几篇二叉树相关的系列文章,大家刷题有没有点感觉了?可以留言和我交流。本文对你有帮助的话,请三连~ +当然,BST 还可以玩出更多花样,提供更丰富的 API,更多内容参见我的数据结构课程中的 [动手实现 TreeMap](https://appktavsiei5995.pc.xiaoe-tech.com/detail/p_62655516e4b0cedf38a93758/6) 章节。 @@ -248,6 +250,6 @@ void traverse(TreeNode root) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST2.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST2.md" index bb1246cba3e3414dcc2c9513a9921eafdf5b0d34..887487b7faccb5b1e60396e42805331f5030698e 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST2.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/BST2.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -311,6 +311,6 @@ void BST(TreeNode root, int target) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/dijkstra\347\256\227\346\263\225.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/dijkstra\347\256\227\346\263\225.md" index 76e0a6e1551bebdca86836135cbb0fa9f8355e3d..418b4cb4448c4a8d15802940c62a19a8fceba4b3 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/dijkstra\347\256\227\346\263\225.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/dijkstra\347\256\227\346\263\225.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -864,6 +864,6 @@ double dijkstra(int start, int end, List[] graph) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\345\240\206\350\257\246\350\247\243\345\256\236\347\216\260\344\274\230\345\205\210\347\272\247\351\230\237\345\210\227.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\345\240\206\350\257\246\350\247\243\345\256\236\347\216\260\344\274\230\345\205\210\347\272\247\351\230\237\345\210\227.md" index 33982ee2281fc6d7f06cc63453e8ac8bb9365b95..bc673a90c46609d59710baa263a493af0cfe4140 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\345\240\206\350\257\246\350\247\243\345\256\236\347\216\260\344\274\230\345\205\210\347\272\247\351\230\237\345\210\227.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\345\240\206\350\257\246\350\247\243\345\256\236\347\216\260\344\274\230\345\205\210\347\272\247\351\230\237\345\210\227.md" @@ -1,13 +1,5 @@ # 二叉堆详解实现优先级队列 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -234,6 +226,45 @@ public Key delMax() { 最后,更多二叉堆/优先级队列相关的题目练习见 [二叉堆(优先级队列)的经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_633faa64e4b0eca59c3a1aa3/1)。 + + +


+
+引用本文的文章 + + - [Dijkstra 算法模板及应用](https://labuladong.github.io/article/fname.html?fname=dijkstra算法) + - [双指针技巧秒杀七道链表题目](https://labuladong.github.io/article/fname.html?fname=链表技巧) + - [如何调度考生的座位](https://labuladong.github.io/article/fname.html?fname=座位调度) + - [快速排序详解及应用](https://labuladong.github.io/article/fname.html?fname=快速排序) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1104. Path In Zigzag Labelled Binary Tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/?show=1) | [1104. 二叉树寻路](https://leetcode.cn/problems/path-in-zigzag-labelled-binary-tree/?show=1) | +| [1845. Seat Reservation Manager](https://leetcode.com/problems/seat-reservation-manager/?show=1) | [1845. 座位预约管理系统](https://leetcode.cn/problems/seat-reservation-manager/?show=1) | +| [23. Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/?show=1) | [23. 合并K个升序链表](https://leetcode.cn/problems/merge-k-sorted-lists/?show=1) | +| [347. Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/?show=1) | [347. 前 K 个高频元素](https://leetcode.cn/problems/top-k-frequent-elements/?show=1) | +| [451. Sort Characters By Frequency](https://leetcode.com/problems/sort-characters-by-frequency/?show=1) | [451. 根据字符出现频率排序](https://leetcode.cn/problems/sort-characters-by-frequency/?show=1) | +| [662. Maximum Width of Binary Tree](https://leetcode.com/problems/maximum-width-of-binary-tree/?show=1) | [662. 二叉树最大宽度](https://leetcode.cn/problems/maximum-width-of-binary-tree/?show=1) | +| [692. Top K Frequent Words](https://leetcode.com/problems/top-k-frequent-words/?show=1) | [692. 前K个高频单词](https://leetcode.cn/problems/top-k-frequent-words/?show=1) | +| [703. Kth Largest Element in a Stream](https://leetcode.com/problems/kth-largest-element-in-a-stream/?show=1) | [703. 数据流中的第 K 大元素](https://leetcode.cn/problems/kth-largest-element-in-a-stream/?show=1) | +| - | [剑指 Offer II 059. 数据流的第 K 大数值](https://leetcode.cn/problems/jBjn9C/?show=1) | +| - | [剑指 Offer II 078. 合并排序链表](https://leetcode.cn/problems/vvXgSW/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223.md" index c1dc73b35bf5e68157e7e51c5c42739c27b13a1d..7e84245be7224c9c3c6903246a48f2df5f592c1e 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -791,6 +791,6 @@ void traverse(List curLevelNodes) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2271.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2271.md" index a2f13b169f80ceca35bfc21276fe0f299105a789..81bdea745cf6912876a67520bb14a5675f56abb5 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2271.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2271.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -388,7 +388,7 @@ void flatten(TreeNode root) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2272.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2272.md" index 87f222cc9f04b12d86781b50f97297e8ab488f4b..4a0d3db7f6c23b262c331db6580df35c841ddeed 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2272.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\344\272\214\345\217\211\346\240\221\347\263\273\345\210\2272.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -175,7 +175,7 @@ void traverse(TreeNode root) { 找到根节点是很简单的,前序遍历的第一个值 `preorder[0]` 就是根节点的值。 -关键在于如何通过根节点的值,将 `preorder` 和 `postorder` 数组划分成两半,构造根节点的左右子树? +关键在于如何通过根节点的值,将 `preorder` 和 `inorder` 数组划分成两半,构造根节点的左右子树? 换句话说,对于以下代码中的 `?` 部分应该填入什么: @@ -583,6 +583,6 @@ int leftRootVal = preorder[preStart + 1]; **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\346\240\210.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\346\240\210.md" index 3b0677098522bdd65588606103b3531b7cfd78e9..7282ead98a8421a14efaaadddbd1c81a848c8115 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\346\240\210.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\346\240\210.md" @@ -1,13 +1,5 @@ # 特殊数据结构:单调栈 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -205,6 +197,43 @@ int[] nextGreaterElements(int[] nums) { 我会在 [单调栈的几种变体](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_628dc1ace4b09dda126cf793/1) 对比单调栈的几种其他形式,并在 [单调栈的运用](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_628dc2d7e4b0cedf38b67734/1) 中给出单调栈的经典例题。更多数据结构设计类题目参见 [数据结构设计经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_6312b9e5e4b0eca59c2b7e93/1)。 + + +


+
+引用本文的文章 + + - [一个方法团灭 LeetCode 打家劫舍问题](https://labuladong.github.io/article/fname.html?fname=抢房子) + - [一道数组去重的算法题把我整不会了](https://labuladong.github.io/article/fname.html?fname=单调栈去重) + - [单调栈代码模板的几种变体](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_628dc1ace4b09dda126cf793/1) + - [单调队列的通用实现及经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a692efe4b01a48520b9b9b/1) + - [单调队列结构解决滑动窗口问题](https://labuladong.github.io/article/fname.html?fname=单调队列) + - [数据结构设计:最大栈](https://labuladong.github.io/article/fname.html?fname=最大栈) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1019. Next Greater Node In Linked List](https://leetcode.com/problems/next-greater-node-in-linked-list/?show=1) | [1019. 链表中的下一个更大节点](https://leetcode.cn/problems/next-greater-node-in-linked-list/?show=1) | +| [1944. Number of Visible People in a Queue](https://leetcode.com/problems/number-of-visible-people-in-a-queue/?show=1) | [1944. 队列中可以看到的人数](https://leetcode.cn/problems/number-of-visible-people-in-a-queue/?show=1) | +| [402. Remove K Digits](https://leetcode.com/problems/remove-k-digits/?show=1) | [402. 移掉 K 位数字](https://leetcode.cn/problems/remove-k-digits/?show=1) | +| [42. Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/?show=1) | [42. 接雨水](https://leetcode.cn/problems/trapping-rain-water/?show=1) | +| [901. Online Stock Span](https://leetcode.com/problems/online-stock-span/?show=1) | [901. 股票价格跨度](https://leetcode.cn/problems/online-stock-span/?show=1) | +| [918. Maximum Sum Circular Subarray](https://leetcode.com/problems/maximum-sum-circular-subarray/?show=1) | [918. 环形子数组的最大和](https://leetcode.cn/problems/maximum-sum-circular-subarray/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\351\230\237\345\210\227.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\351\230\237\345\210\227.md" index b8c239a0119403ac146e5dcc52cab6c138bd27e9..bcbcc25c8d235fa7283becb49b74bdd2d11287cc 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\351\230\237\345\210\227.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\215\225\350\260\203\351\230\237\345\210\227.md" @@ -1,13 +1,5 @@ # 特殊数据结构:单调队列 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -272,6 +264,38 @@ class MonotonicQueue> { 我将在 [单调队列通用实现及应用](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a692efe4b01a48520b9b9b/1) 中给出单调队列的通用实现和经典习题。更多数据结构设计类题目参见 [数据结构设计经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_6312b9e5e4b0eca59c2b7e93/1)。 + + +


+
+引用本文的文章 + + - [数据结构设计:最大栈](https://labuladong.github.io/article/fname.html?fname=最大栈) + - [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1425. Constrained Subsequence Sum](https://leetcode.com/problems/constrained-subsequence-sum/?show=1) | [1425. 带限制的子序列和](https://leetcode.cn/problems/constrained-subsequence-sum/?show=1) | +| [1696. Jump Game VI](https://leetcode.com/problems/jump-game-vi/?show=1) | [1696. 跳跃游戏 VI](https://leetcode.cn/problems/jump-game-vi/?show=1) | +| [862. Shortest Subarray with Sum at Least K](https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k/?show=1) | [862. 和至少为 K 的最短子数组](https://leetcode.cn/problems/shortest-subarray-with-sum-at-least-k/?show=1) | +| [918. Maximum Sum Circular Subarray](https://leetcode.com/problems/maximum-sum-circular-subarray/?show=1) | [918. 环形子数组的最大和](https://leetcode.cn/problems/maximum-sum-circular-subarray/?show=1) | +| - | [剑指 Offer 59 - I. 滑动窗口的最大值](https://leetcode.cn/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\233\276.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\233\276.md" index d31d28ec99e853755d4050b6285a962eb64432cf..b776da29001c24f42456e9525fd0e410711bc010 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\233\276.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\233\276.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -354,6 +354,6 @@ void traverse(int[][] graph, int s, LinkedList path) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\256\236\347\216\260\350\256\241\347\256\227\345\231\250.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\256\236\347\216\260\350\256\241\347\256\227\345\231\250.md" index f81830bcc4c4241fcab30609d868647ab282b83c..106f8e5ad3e6c2251bbf233e5f1e0f9690a926ee 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\256\236\347\216\260\350\256\241\347\256\227\345\231\250.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\345\256\236\347\216\260\350\256\241\347\256\227\345\231\250.md" @@ -1,11 +1,5 @@ # 拆解复杂问题:实现计算器 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -311,6 +305,20 @@ def calculate(s: str) -> int: **退而求其次是一种很聪明策略**。你想想啊,假设这是一道考试题,你不会实现这个计算器,但是你写了字符串转整数的算法并指出了容易溢出的陷阱,那起码可以得 20 分吧;如果你能够处理加减法,那可以得 40 分吧;如果你能处理加减乘除四则运算,那起码够 70 分了;再加上处理空格字符,80 有了吧。我就是不会处理括号,那就算了,80 已经很 OK 了好不好。 + + +


+
+引用本文的文章 + + - [算法笔试「骗分」套路](https://labuladong.github.io/article/fname.html?fname=刷题技巧) + +

+ + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\346\213\223\346\211\221\346\216\222\345\272\217.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\346\213\223\346\211\221\346\216\222\345\272\217.md" index e8957b135f4f7fdc26ef03dd34081286c9c89d7c..b8e12b01edbed03f015d2ed5679e0e7f5dd36541 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\346\213\223\346\211\221\346\216\222\345\272\217.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\346\213\223\346\211\221\346\216\222\345\272\217.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -602,6 +602,6 @@ List[] buildGraph(int n, int[][] edges) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\350\256\276\350\256\241Twitter.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\350\256\276\350\256\241Twitter.md" index f2b409cec0dfbdca9d04e9ebe07e84356c5878a8..60294dc2a5f34a2af653e9e377d393536fecee92 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\350\256\276\350\256\241Twitter.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\350\256\276\350\256\241Twitter.md" @@ -1,11 +1,5 @@ # 设计Twitter - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -296,6 +290,20 @@ public List getNewsFeed(int userId) { 本文就到这里,更多数据结构设计相关的题目参见 [数据结构设计经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_6312b9e5e4b0eca59c2b7e93/1)。 + + +


+
+引用本文的文章 + + - [数据结构设计:最大栈](https://labuladong.github.io/article/fname.html?fname=最大栈) + +

+ + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\200\222\345\275\222\345\217\215\350\275\254\351\223\276\350\241\250\347\232\204\344\270\200\351\203\250\345\210\206.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\200\222\345\275\222\345\217\215\350\275\254\351\223\276\350\241\250\347\232\204\344\270\200\351\203\250\345\210\206.md" index 7f228726e2fd2369d765dadc136c44ee13695448..fe37a3ff51dc4be3b345803b98334516be2b7781 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\200\222\345\275\222\345\217\215\350\275\254\351\223\276\350\241\250\347\232\204\344\270\200\351\203\250\345\210\206.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\200\222\345\275\222\345\217\215\350\275\254\351\223\276\350\241\250\347\232\204\344\270\200\351\203\250\345\210\206.md" @@ -1,13 +1,5 @@ # 递归反转链表的一部分 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -229,6 +221,35 @@ ListNode reverseBetween(ListNode head, int m, int n) { 最后,我在数据结构精品课中讲解了 [单链表的递归实现](https://aep.h5.xeknow.com/s/1RQzXc),应该能够让你进一步加深对递归的理解。 + + +


+
+引用本文的文章 + + - [如何判断回文链表](https://labuladong.github.io/article/fname.html?fname=判断回文链表) + - [烧饼排序算法](https://labuladong.github.io/article/fname.html?fname=烧饼排序) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| - | [剑指 Offer 24. 反转链表](https://leetcode.cn/problems/fan-zhuan-lian-biao-lcof/?show=1) | +| - | [剑指 Offer II 024. 反转链表](https://leetcode.cn/problems/UHnkqh/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" index 7fd57ea00c148af2633420be9f2d9aa37cb60555..645f6800109f62736d47e6b4c4f4c8fbde6bafb0 100644 --- "a/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" +++ "b/\346\225\260\346\215\256\347\273\223\346\236\204\347\263\273\345\210\227/\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" @@ -1,9 +1,5 @@ # 队列实现栈|栈实现队列 - - - -

GitHub @@ -13,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -227,6 +223,23 @@ public boolean empty() { 希望本文对你有帮助。 + + + +


+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| - | [剑指 Offer 09. 用两个栈实现队列](https://leetcode.cn/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\346\241\206\346\236\266.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\346\241\206\346\236\266.md" index 01541bf1d9b6432581f42c5870b62b04de3bf453..9109723e3daf18d181b4952c684452bd2a9b83e1 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\346\241\206\346\236\266.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\346\241\206\346\236\266.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -424,6 +424,6 @@ while (!q1.isEmpty() && !q2.isEmpty()) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\350\247\243\345\206\263\346\273\221\345\212\250\346\213\274\345\233\276.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\350\247\243\345\206\263\346\273\221\345\212\250\346\213\274\345\233\276.md" index 40e7d6ba3257a78e902f8ff0d960ca1b262e833c..17c48170892cf8d81ff7e97567e071c7917f5071 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\350\247\243\345\206\263\346\273\221\345\212\250\346\213\274\345\233\276.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/BFS\350\247\243\345\206\263\346\273\221\345\212\250\346\213\274\345\233\276.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -183,6 +183,6 @@ private String swap(char[] chars, int i, int j) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/UnionFind\347\256\227\346\263\225\350\257\246\350\247\243.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/UnionFind\347\256\227\346\263\225\350\257\246\350\247\243.md" index 6f11fed5fdeb6edde77101acf7479561ce375c81..53e6bf143abe46dec493504bf2386ae5f5a0ca8a 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/UnionFind\347\256\227\346\263\225\350\257\246\350\247\243.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/UnionFind\347\256\227\346\263\225\350\257\246\350\247\243.md" @@ -1,11 +1,5 @@ # Union-Find 算法详解 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -529,6 +523,41 @@ class UF { 最后,Union-Find 算法也会在一些其他经典图论算法中用到,比如判断「图」和「树」,以及最小生成树的计算,详情见 [Kruskal 最小生成树算法](https://labuladong.github.io/article/fname.html?fname=kruskal)。 + + +


+
+引用本文的文章 + + - [Dijkstra 算法模板及应用](https://labuladong.github.io/article/fname.html?fname=dijkstra算法) + - [Kruskal 最小生成树算法](https://labuladong.github.io/article/fname.html?fname=kruskal) + - [Prim 最小生成树算法](https://labuladong.github.io/article/fname.html?fname=prim算法) + - [一文秒杀所有岛屿题目](https://labuladong.github.io/article/fname.html?fname=岛屿题目) + - [二分图判定算法](https://labuladong.github.io/article/fname.html?fname=二分图) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1361. Validate Binary Tree Nodes](https://leetcode.com/problems/validate-binary-tree-nodes/?show=1) | [1361. 验证二叉树](https://leetcode.cn/problems/validate-binary-tree-nodes/?show=1) | +| [200. Number of Islands](https://leetcode.com/problems/number-of-islands/?show=1) | [200. 岛屿数量](https://leetcode.cn/problems/number-of-islands/?show=1) | +| [261. Graph Valid Tree](https://leetcode.com/problems/graph-valid-tree/?show=1)🔒 | [261. 以图判树](https://leetcode.cn/problems/graph-valid-tree/?show=1)🔒 | +| [765. Couples Holding Hands](https://leetcode.com/problems/couples-holding-hands/?show=1) | [765. 情侣牵手](https://leetcode.cn/problems/couples-holding-hands/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\350\257\246\350\247\243.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\350\257\246\350\247\243.md" index f3e5d4103d6e954304f059d2ef28a4c9685cdc37..706b417856ea02479fec3343de18e0424efe4c3b 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\350\257\246\350\247\243.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\350\257\246\350\247\243.md" @@ -1,13 +1,5 @@ # 二分查找算法详解 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -507,6 +499,60 @@ int right_bound(int[] nums, int target) { 理解本文能保证你写出正确的二分查找的代码,但实际题目中不会直接让你写二分代码,我会在 [二分查找的变体](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a07736e4b01a485209b0b4/1) 和 [二分查找的运用](https://labuladong.github.io/article/fname.html?fname=二分运用) 中进一步讲解如何把二分思维运用到更多算法题中。 + + +


+
+引用本文的文章 + + - [base case 和备忘录的初始值怎么定?](https://labuladong.github.io/article/fname.html?fname=备忘录等基础) + - [丑数系列算法详解](https://labuladong.github.io/article/fname.html?fname=丑数) + - [二分搜索怎么用?我又总结了套路](https://labuladong.github.io/article/fname.html?fname=二分运用) + - [二分搜索怎么用?我和快手面试官进行了深度探讨](https://labuladong.github.io/article/fname.html?fname=二分分割子数组) + - [二分搜索算法经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a07736e4b01a485209b0b4/1) + - [二分查找高效判定子序列](https://labuladong.github.io/article/fname.html?fname=二分查找判定子序列) + - [动态规划设计:最长递增子序列](https://labuladong.github.io/article/fname.html?fname=动态规划设计:最长递增子序列) + - [双指针技巧秒杀七道数组题目](https://labuladong.github.io/article/fname.html?fname=双指针技巧) + - [存储系统设计之 LSM 树原理](https://labuladong.github.io/article/fname.html?fname=LSM树) + - [带权重的随机选择算法](https://labuladong.github.io/article/fname.html?fname=随机权重) + - [快速排序详解及应用](https://labuladong.github.io/article/fname.html?fname=快速排序) + - [我写了首诗,把滑动窗口算法变成了默写题](https://labuladong.github.io/article/fname.html?fname=滑动窗口技巧进阶) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + - [讲两道常考的阶乘算法题](https://labuladong.github.io/article/fname.html?fname=阶乘题目) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1201. Ugly Number III](https://leetcode.com/problems/ugly-number-iii/?show=1) | [1201. 丑数 III](https://leetcode.cn/problems/ugly-number-iii/?show=1) | +| [162. Find Peak Element](https://leetcode.com/problems/find-peak-element/?show=1) | [162. 寻找峰值](https://leetcode.cn/problems/find-peak-element/?show=1) | +| [240. Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/?show=1) | [240. 搜索二维矩阵 II](https://leetcode.cn/problems/search-a-2d-matrix-ii/?show=1) | +| [33. Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/?show=1) | [33. 搜索旋转排序数组](https://leetcode.cn/problems/search-in-rotated-sorted-array/?show=1) | +| [35. Search Insert Position](https://leetcode.com/problems/search-insert-position/?show=1) | [35. 搜索插入位置](https://leetcode.cn/problems/search-insert-position/?show=1) | +| [658. Find K Closest Elements](https://leetcode.com/problems/find-k-closest-elements/?show=1) | [658. 找到 K 个最接近的元素](https://leetcode.cn/problems/find-k-closest-elements/?show=1) | +| [74. Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/?show=1) | [74. 搜索二维矩阵](https://leetcode.cn/problems/search-a-2d-matrix/?show=1) | +| [793. Preimage Size of Factorial Zeroes Function](https://leetcode.com/problems/preimage-size-of-factorial-zeroes-function/?show=1) | [793. 阶乘函数后 K 个零](https://leetcode.cn/problems/preimage-size-of-factorial-zeroes-function/?show=1) | +| [81. Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii/?show=1) | [81. 搜索旋转排序数组 II](https://leetcode.cn/problems/search-in-rotated-sorted-array-ii/?show=1) | +| [852. Peak Index in a Mountain Array](https://leetcode.com/problems/peak-index-in-a-mountain-array/?show=1) | [852. 山脉数组的峰顶索引](https://leetcode.cn/problems/peak-index-in-a-mountain-array/?show=1) | +| - | [剑指 Offer 04. 二维数组中的查找](https://leetcode.cn/problems/er-wei-shu-zu-zhong-de-cha-zhao-lcof/?show=1) | +| - | [剑指 Offer 53 - I. 在排序数组中查找数字 I](https://leetcode.cn/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/?show=1) | +| - | [剑指 Offer 53 - II. 0~n-1中缺失的数字](https://leetcode.cn/problems/que-shi-de-shu-zi-lcof/?show=1) | +| - | [剑指 Offer II 068. 查找插入位置](https://leetcode.cn/problems/N6YdxV/?show=1) | +| - | [剑指 Offer II 069. 山峰数组的顶部](https://leetcode.cn/problems/B1IidL/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\207\240\344\270\252\345\217\215\347\233\264\350\247\211\347\232\204\346\246\202\347\216\207\351\227\256\351\242\230.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\207\240\344\270\252\345\217\215\347\233\264\350\247\211\347\232\204\346\246\202\347\216\207\351\227\256\351\242\230.md" index f8e389e4ad192a0adb02ff6a8de975e82ef3a112..fed30356094a18bee50734505d34d55c1531daa5 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\207\240\344\270\252\345\217\215\347\233\264\350\247\211\347\232\204\346\246\202\347\216\207\351\227\256\351\242\230.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\207\240\344\270\252\345\217\215\347\233\264\350\247\211\347\232\204\346\246\202\347\216\207\351\227\256\351\242\230.md" @@ -9,13 +9,13 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** **-----------** -上篇文章 [洗牌算法详解](https://labuladong.github.io/article/fname.html?fname=洗牌算法) 讲到了验证概率算法的蒙特卡罗方法,今天聊点轻松的内容:几个和概率相关的有趣问题。 +上篇文章 [谈谈游戏中的随机算法](https://labuladong.github.io/article/fname.html?fname=随机算法) 讲到了验证概率算法的蒙特卡罗方法,今天聊点轻松的内容:几个和概率相关的有趣问题。 计算概率有下面两个最简单的原则: @@ -133,7 +133,7 @@ **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\211\215\347\274\200\345\222\214\346\212\200\345\267\247.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\211\215\347\274\200\345\222\214\346\212\200\345\267\247.md" index 0886e61c1cf71f698671fe8b6b3b0cd99ec3d311..44f9ee5bd212714a61ce4fd34e230dda150a5354 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\211\215\347\274\200\345\222\214\346\212\200\345\267\247.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\211\215\347\274\200\345\222\214\346\212\200\345\267\247.md" @@ -1,13 +1,5 @@ # 经典数组技巧:前缀和数组 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -185,6 +177,55 @@ class NumMatrix { 除了本文举例的基本用法,前缀和数组经常和其他数据结构或算法技巧相结合,我会在 [前缀和技巧高频习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_627cd61de4b0cedf38b0f3a0/1) 中举例讲解。 + + +


+
+引用本文的文章 + + - [二维数组的花式遍历技巧](https://labuladong.github.io/article/fname.html?fname=花式遍历) + - [动态规划设计:最大子数组](https://labuladong.github.io/article/fname.html?fname=最大子数组) + - [小而美的算法技巧:差分数组](https://labuladong.github.io/article/fname.html?fname=差分技巧) + - [带权重的随机选择算法](https://labuladong.github.io/article/fname.html?fname=随机权重) + - [归并排序详解及应用](https://labuladong.github.io/article/fname.html?fname=归并排序) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1314. Matrix Block Sum](https://leetcode.com/problems/matrix-block-sum/?show=1) | [1314. 矩阵区域和](https://leetcode.cn/problems/matrix-block-sum/?show=1) | +| [1352. Product of the Last K Numbers](https://leetcode.com/problems/product-of-the-last-k-numbers/?show=1) | [1352. 最后 K 个数的乘积](https://leetcode.cn/problems/product-of-the-last-k-numbers/?show=1) | +| [238. Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/?show=1) | [238. 除自身以外数组的乘积](https://leetcode.cn/problems/product-of-array-except-self/?show=1) | +| [327. Count of Range Sum](https://leetcode.com/problems/count-of-range-sum/?show=1) | [327. 区间和的个数](https://leetcode.cn/problems/count-of-range-sum/?show=1) | +| [437. Path Sum III](https://leetcode.com/problems/path-sum-iii/?show=1) | [437. 路径总和 III](https://leetcode.cn/problems/path-sum-iii/?show=1) | +| [523. Continuous Subarray Sum](https://leetcode.com/problems/continuous-subarray-sum/?show=1) | [523. 连续的子数组和](https://leetcode.cn/problems/continuous-subarray-sum/?show=1) | +| [525. Contiguous Array](https://leetcode.com/problems/contiguous-array/?show=1) | [525. 连续数组](https://leetcode.cn/problems/contiguous-array/?show=1) | +| [560. Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k/?show=1) | [560. 和为 K 的子数组](https://leetcode.cn/problems/subarray-sum-equals-k/?show=1) | +| [724. Find Pivot Index](https://leetcode.com/problems/find-pivot-index/?show=1) | [724. 寻找数组的中心下标](https://leetcode.cn/problems/find-pivot-index/?show=1) | +| [862. Shortest Subarray with Sum at Least K](https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k/?show=1) | [862. 和至少为 K 的最短子数组](https://leetcode.cn/problems/shortest-subarray-with-sum-at-least-k/?show=1) | +| [918. Maximum Sum Circular Subarray](https://leetcode.com/problems/maximum-sum-circular-subarray/?show=1) | [918. 环形子数组的最大和](https://leetcode.cn/problems/maximum-sum-circular-subarray/?show=1) | +| [974. Subarray Sums Divisible by K](https://leetcode.com/problems/subarray-sums-divisible-by-k/?show=1) | [974. 和可被 K 整除的子数组](https://leetcode.cn/problems/subarray-sums-divisible-by-k/?show=1) | +| - | [剑指 Offer 57 - II. 和为s的连续正数序列](https://leetcode.cn/problems/he-wei-sde-lian-xu-zheng-shu-xu-lie-lcof/?show=1) | +| - | [剑指 Offer II 010. 和为 k 的子数组](https://leetcode.cn/problems/QTMn0o/?show=1) | +| - | [剑指 Offer II 011. 0 和 1 个数相同的子数组](https://leetcode.cn/problems/A1NYOS/?show=1) | +| - | [剑指 Offer II 012. 左右两边子数组的和相等](https://leetcode.cn/problems/tvdfij/?show=1) | +| - | [剑指 Offer II 013. 二维子矩阵的和](https://leetcode.cn/problems/O4NDxx/?show=1) | +| - | [剑指 Offer II 050. 向下的路径节点之和](https://leetcode.cn/problems/6eUYwP/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\217\214\346\214\207\351\222\210\346\212\200\345\267\247.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\217\214\346\214\207\351\222\210\346\212\200\345\267\247.md" index fc2343365c07c504a2d3d1fbf7feef4bda4049a0..918bf57ced35a6faa136f24fbcd6c03f75719c7f 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\217\214\346\214\207\351\222\210\346\212\200\345\267\247.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\217\214\346\214\207\351\222\210\346\212\200\345\267\247.md" @@ -1,13 +1,5 @@ # 数组双指针技巧汇总 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -387,6 +379,51 @@ String longestPalindrome(String s) { 到这里,数组相关的双指针技巧就全部讲完了,这些技巧的更多扩展延伸见 [更多双指针经典高频题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a1dd68e4b09dda1273a5f9/1)。 + + +


+
+引用本文的文章 + + - [一个方法团灭 nSum 问题](https://labuladong.github.io/article/fname.html?fname=nSum) + - [分治算法详解:运算优先级](https://labuladong.github.io/article/fname.html?fname=分治算法) + - [动态规划之子序列问题解题模板](https://labuladong.github.io/article/fname.html?fname=子序列问题模板) + - [双指针更多经典习题](https://appktavsiei5995.pc.xiaoe-tech.com/detail/i_62a1dd68e4b09dda1273a5f9/1) + - [如何判断回文链表](https://labuladong.github.io/article/fname.html?fname=判断回文链表) + - [我写了首诗,把滑动窗口算法变成了默写题](https://labuladong.github.io/article/fname.html?fname=滑动窗口技巧进阶) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + - [扫描线技巧:安排会议室](https://labuladong.github.io/article/fname.html?fname=安排会议室) + - [田忌赛马背后的算法决策](https://labuladong.github.io/article/fname.html?fname=田忌赛马) + - [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) + - [算法笔试「骗分」套路](https://labuladong.github.io/article/fname.html?fname=刷题技巧) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1. Two Sum](https://leetcode.com/problems/two-sum/?show=1) | [1. 两数之和](https://leetcode.cn/problems/two-sum/?show=1) | +| [281. Zigzag Iterator](https://leetcode.com/problems/zigzag-iterator/?show=1)🔒 | [281. 锯齿迭代器](https://leetcode.cn/problems/zigzag-iterator/?show=1)🔒 | +| [42. Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/?show=1) | [42. 接雨水](https://leetcode.cn/problems/trapping-rain-water/?show=1) | +| [658. Find K Closest Elements](https://leetcode.com/problems/find-k-closest-elements/?show=1) | [658. 找到 K 个最接近的元素](https://leetcode.cn/problems/find-k-closest-elements/?show=1) | +| [80. Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/?show=1) | [80. 删除有序数组中的重复项 II](https://leetcode.cn/problems/remove-duplicates-from-sorted-array-ii/?show=1) | +| [82. Remove Duplicates from Sorted List II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/?show=1) | [82. 删除排序链表中的重复元素 II](https://leetcode.cn/problems/remove-duplicates-from-sorted-list-ii/?show=1) | +| [9. Palindrome Number](https://leetcode.com/problems/palindrome-number/?show=1) | [9. 回文数](https://leetcode.cn/problems/palindrome-number/?show=1) | +| - | [剑指 Offer 21. 调整数组顺序使奇数位于偶数前面](https://leetcode.cn/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/?show=1) | +| - | [剑指 Offer 57. 和为s的两个数字](https://leetcode.cn/problems/he-wei-sde-liang-ge-shu-zi-lcof/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\233\236\346\272\257\347\256\227\346\263\225\350\257\246\350\247\243\344\277\256\350\256\242\347\211\210.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\233\236\346\272\257\347\256\227\346\263\225\350\257\246\350\247\243\344\277\256\350\256\242\347\211\210.md" index 269658594264c5fadbbb27f57109a5f8b292b6f7..8f9a57af8ebf7d4130938b7053382246f26d6ef5 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\233\236\346\272\257\347\256\227\346\263\225\350\257\246\350\247\243\344\277\256\350\256\242\347\211\210.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\233\236\346\272\257\347\256\227\346\263\225\350\257\246\350\247\243\344\277\256\350\256\242\347\211\210.md" @@ -1,11 +1,5 @@ # 回溯算法详解 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -335,6 +329,67 @@ def backtrack(...): 动态规划和回溯算法底层都把问题抽象成了树的结构,但这两种算法在思路上是完全不同的。在 [东哥带你刷二叉树(纲领篇)](https://labuladong.github.io/article/fname.html?fname=二叉树总结) 你将看到动态规划和回溯算法更深层次的区别和联系。 + + +


+
+引用本文的文章 + + - [BFS 算法解题套路框架](https://labuladong.github.io/article/fname.html?fname=BFS框架) + - [Dijkstra 算法模板及应用](https://labuladong.github.io/article/fname.html?fname=dijkstra算法) + - [FloodFill算法详解及应用](https://labuladong.github.io/article/fname.html?fname=FloodFill算法详解及应用) + - [base case 和备忘录的初始值怎么定?](https://labuladong.github.io/article/fname.html?fname=备忘录等基础) + - [东哥带你刷二叉树(纲领篇)](https://labuladong.github.io/article/fname.html?fname=二叉树总结) + - [两种思路解决单词拼接问题](https://labuladong.github.io/article/fname.html?fname=单词拼接) + - [二分搜索怎么用?我和快手面试官进行了深度探讨](https://labuladong.github.io/article/fname.html?fname=二分分割子数组) + - [分治算法详解:运算优先级](https://labuladong.github.io/article/fname.html?fname=分治算法) + - [前缀树算法模板秒杀五道算法题](https://labuladong.github.io/article/fname.html?fname=trie) + - [动态规划和回溯算法到底谁是谁爹?](https://labuladong.github.io/article/fname.html?fname=targetSum) + - [回溯算法最佳实践:括号生成](https://labuladong.github.io/article/fname.html?fname=合法括号生成) + - [回溯算法最佳实践:解数独](https://labuladong.github.io/article/fname.html?fname=sudoku) + - [回溯算法秒杀所有排列/组合/子集问题](https://labuladong.github.io/article/fname.html?fname=子集排列组合) + - [图论基础及遍历算法](https://labuladong.github.io/article/fname.html?fname=图) + - [学习算法和刷题的框架思维](https://labuladong.github.io/article/fname.html?fname=学习数据结构和算法的高效方法) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + - [环检测及拓扑排序算法](https://labuladong.github.io/article/fname.html?fname=拓扑排序) + - [算法学习和心流体验](https://labuladong.github.io/article/fname.html?fname=心流) + - [算法笔试「骗分」套路](https://labuladong.github.io/article/fname.html?fname=刷题技巧) + - [经典动态规划:戳气球](https://labuladong.github.io/article/fname.html?fname=扎气球) + - [经典回溯算法:集合划分问题](https://labuladong.github.io/article/fname.html?fname=集合划分) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [112. Path Sum](https://leetcode.com/problems/path-sum/?show=1) | [112. 路径总和](https://leetcode.cn/problems/path-sum/?show=1) | +| [113. Path Sum II](https://leetcode.com/problems/path-sum-ii/?show=1) | [113. 路径总和 II](https://leetcode.cn/problems/path-sum-ii/?show=1) | +| [140. Word Break II](https://leetcode.com/problems/word-break-ii/?show=1) | [140. 单词拆分 II](https://leetcode.cn/problems/word-break-ii/?show=1) | +| [17. Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/?show=1) | [17. 电话号码的字母组合](https://leetcode.cn/problems/letter-combinations-of-a-phone-number/?show=1) | +| [22. Generate Parentheses](https://leetcode.com/problems/generate-parentheses/?show=1) | [22. 括号生成](https://leetcode.cn/problems/generate-parentheses/?show=1) | +| [39. Combination Sum](https://leetcode.com/problems/combination-sum/?show=1) | [39. 组合总和](https://leetcode.cn/problems/combination-sum/?show=1) | +| [698. Partition to K Equal Sum Subsets](https://leetcode.com/problems/partition-to-k-equal-sum-subsets/?show=1) | [698. 划分为k个相等的子集](https://leetcode.cn/problems/partition-to-k-equal-sum-subsets/?show=1) | +| [77. Combinations](https://leetcode.com/problems/combinations/?show=1) | [77. 组合](https://leetcode.cn/problems/combinations/?show=1) | +| [78. Subsets](https://leetcode.com/problems/subsets/?show=1) | [78. 子集](https://leetcode.cn/problems/subsets/?show=1) | +| - | [剑指 Offer 34. 二叉树中和为某一值的路径](https://leetcode.cn/problems/er-cha-shu-zhong-he-wei-mou-yi-zhi-de-lu-jing-lcof/?show=1) | +| - | [剑指 Offer II 079. 所有子集](https://leetcode.cn/problems/TVdhkn/?show=1) | +| - | [剑指 Offer II 080. 含有 k 个元素的组合](https://leetcode.cn/problems/uUsW3B/?show=1) | +| - | [剑指 Offer II 081. 允许重复选择元素的组合](https://leetcode.cn/problems/Ygoe9J/?show=1) | +| - | [剑指 Offer II 083. 没有重复元素集合的全排列](https://leetcode.cn/problems/VvJkup/?show=1) | +| - | [剑指 Offer II 085. 生成匹配的括号](https://leetcode.cn/problems/IDBivT/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\227\347\254\246\344\270\262\344\271\230\346\263\225.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\227\347\254\246\344\270\262\344\271\230\346\263\225.md" index b285fb9c32fd688076904ad715ff4b56bcfe267f..b4512e9e4dea56b7189e1b125a4dfcecba9647d1 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\227\347\254\246\344\270\262\344\271\230\346\263\225.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\227\347\254\246\344\270\262\344\271\230\346\263\225.md" @@ -1,11 +1,5 @@ # 字符串乘法 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -100,6 +94,10 @@ string multiply(string num1, string num2) { 也许算法就是一种**寻找思维定式的思维**吧,希望本文对你有帮助。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\246\344\271\240\346\225\260\346\215\256\347\273\223\346\236\204\345\222\214\347\256\227\346\263\225\347\232\204\351\253\230\346\225\210\346\226\271\346\263\225.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\246\344\271\240\346\225\260\346\215\256\347\273\223\346\236\204\345\222\214\347\256\227\346\263\225\347\232\204\351\253\230\346\225\210\346\226\271\346\263\225.md" index 33e458980bf02740728347e433921b632b6c9de1..38a74434f28e82a28c6ca21322f000ddcf6a1544 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\246\344\271\240\346\225\260\346\215\256\347\273\223\346\236\204\345\222\214\347\256\227\346\263\225\347\232\204\351\253\230\346\225\210\346\226\271\346\263\225.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\255\246\344\271\240\346\225\260\346\215\256\347\273\223\346\236\204\345\222\214\347\256\227\346\263\225\347\232\204\351\253\230\346\225\210\346\226\271\346\263\225.md" @@ -1,4 +1,4 @@ -# 学习算法和刷题的思路指南 +# 学习数据结构和算法的框架思维

GitHub @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -350,6 +350,7 @@ N 叉树的遍历框架,找出来了吧?你说,树这种结构重不重要 - [图论基础及遍历算法](https://labuladong.github.io/article/fname.html?fname=图) - [如何 K 个一组反转链表](https://labuladong.github.io/article/fname.html?fname=k个一组反转链表) - [如何判断回文链表](https://labuladong.github.io/article/fname.html?fname=判断回文链表) + - [存储系统设计之 LSM 树原理](https://labuladong.github.io/article/fname.html?fname=LSM树) - [归并排序详解及应用](https://labuladong.github.io/article/fname.html?fname=归并排序) - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) - [环检测及拓扑排序算法](https://labuladong.github.io/article/fname.html?fname=拓扑排序) @@ -381,7 +382,7 @@ N 叉树的遍历框架,找出来了吧?你说,树这种结构重不重要 **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\267\256\345\210\206\346\212\200\345\267\247.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\267\256\345\210\206\346\212\200\345\267\247.md" index b5b3eefc82862743c0cd65095ea223c85a5df8e3..2ad5b80781c904cec364ceeb18ff3477ee154643 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\267\256\345\210\206\346\212\200\345\267\247.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\267\256\345\210\206\346\212\200\345\267\247.md" @@ -1,4 +1,4 @@ -# 那些小而美的算法技巧:前缀和/差分数组 +# 经典数组技巧:差分数组

GitHub @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -275,7 +275,7 @@ boolean carPooling(int[][] trips, int capacity) { 最后,差分数组和前缀和数组都是比较常见且巧妙的算法技巧,分别适用不同的场景,而且是会者不难,难者不会。所以,关于差分数组的使用,你学会了吗? -> 最后打个广告,我亲自制作了一门 [数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO),以视频课为主,手把手带你实现常用的数据结构及相关算法,旨在帮助算法基础较为薄弱的读者深入理解常用数据结构的底层原理,在算法学习中少走弯路。 +更多经典的数组/链表技巧习题见 [数组链表解题技巧精讲](https://appktavsiei5995.pc.xiaoe-tech.com/detail/p_62655effe4b0812e1790ecd7/6)。 @@ -295,6 +295,6 @@ boolean carPooling(int[][] trips, int capacity) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\270\270\347\224\250\347\232\204\344\275\215\346\223\215\344\275\234.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\270\270\347\224\250\347\232\204\344\275\215\346\223\215\344\275\234.md" index d109f1f3f0622cea8463437548848a1ef1e5c884..2fb413a9ad8a2f7986fa84b1f86426ca8cb7f142 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\270\270\347\224\250\347\232\204\344\275\215\346\223\215\344\275\234.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\345\270\270\347\224\250\347\232\204\344\275\215\346\223\215\344\275\234.md" @@ -1,9 +1,5 @@ # 常用的位运算技巧 - - - -

GitHub @@ -13,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -247,6 +243,35 @@ int missingNumber(int[] nums) { http://graphics.stanford.edu/~seander/bithacks.html#ReverseParallel + + +


+
+引用本文的文章 + + - [丑数系列算法详解](https://labuladong.github.io/article/fname.html?fname=丑数) + - [如何同时寻找缺失和重复的元素](https://labuladong.github.io/article/fname.html?fname=缺失和重复的元素) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [389. Find the Difference](https://leetcode.com/problems/find-the-difference/?show=1) | [389. 找不同](https://leetcode.cn/problems/find-the-difference/?show=1) | +| - | [剑指 Offer 15. 二进制中1的个数](https://leetcode.cn/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\264\227\347\211\214\347\256\227\346\263\225.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\264\227\347\211\214\347\256\227\346\263\225.md" index b7fc9a37d744ea8db0388d279f72242ac7a4b310..c53f3d2a626b8c77db79e1e17549342dc719304f 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\264\227\347\211\214\347\256\227\346\263\225.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\264\227\347\211\214\347\256\227\346\263\225.md" @@ -1,7 +1,5 @@ # 洗牌算法 - -

GitHub @@ -11,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -204,6 +202,10 @@ for (int feq : count) 第二部分写了洗牌算法正确性的衡量标准,即每种随机结果出现的概率必须相等。如果我们不用严格的数学证明,可以通过蒙特卡罗方法大力出奇迹,粗略验证算法的正确性。蒙特卡罗方法也有不同的思路,不过要求不必太严格,因为我们只是寻求一个简单的验证。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\273\221\345\212\250\347\252\227\345\217\243\346\212\200\345\267\247\350\277\233\351\230\266.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\273\221\345\212\250\347\252\227\345\217\243\346\212\200\345\267\247\350\277\233\351\230\266.md" index dccf74541ae52c5d9f285e9d75d12169ec224729..95568c7a0ce92fd3ec0e86505f19eba6c2f8915c 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\273\221\345\212\250\347\252\227\345\217\243\346\212\200\345\267\247\350\277\233\351\230\266.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\346\273\221\345\212\250\347\252\227\345\217\243\346\212\200\345\267\247\350\277\233\351\230\266.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -314,7 +314,7 @@ bool checkInclusion(string t, string s) { 对于这道题的解法代码,基本上和最小覆盖子串一模一样,只需要改变几个地方: -1、本题移动 `left` 缩小窗口的时机是窗口大小大于 `t.size()` 时,应为排列嘛,显然长度应该是一样的。 +1、本题移动 `left` 缩小窗口的时机是窗口大小大于 `t.size()` 时,因为排列嘛,显然长度应该是一样的。 2、当发现 `valid == need.size()` 时,就说明窗口中就是一个合法的排列,所以立即返回 `true`。 @@ -476,6 +476,6 @@ int lengthOfLongestSubstring(string s) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\347\203\247\351\245\274\346\216\222\345\272\217.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\347\203\247\351\245\274\346\216\222\345\272\217.md" index 1ac34a4a6083d71092c799d5bb899cdd23195e5a..c31356d8c4aa80009fdbe43673b73a1e96ebf45b 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\347\203\247\351\245\274\346\216\222\345\272\217.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\347\203\247\351\245\274\346\216\222\345\272\217.md" @@ -1,11 +1,5 @@ # 烧饼排序 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -148,6 +142,10 @@ void reverse(int[] arr, int i, int j) { 不妨分享一下你的思考。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\350\212\261\345\274\217\351\201\215\345\216\206.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\350\212\261\345\274\217\351\201\215\345\216\206.md" index b370ee1c84d9c6d1c885de8e3b3d3db386ebc074..679dc46581d3541cb5ac1a153732980e3bd3a9ea 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\350\212\261\345\274\217\351\201\215\345\216\206.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\350\212\261\345\274\217\351\201\215\345\216\206.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -326,6 +326,6 @@ int[][] generateMatrix(int n) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\351\233\206\345\220\210\345\210\222\345\210\206.md" "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\351\233\206\345\220\210\345\210\222\345\210\206.md" index 8092d38a92392d5faccef3a0f99c08203734cb5a..602b1d99b868974c32cd3afba81f79268b840a2e 100644 --- "a/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\351\233\206\345\220\210\345\210\222\345\210\206.md" +++ "b/\347\256\227\346\263\225\346\200\235\347\273\264\347\263\273\345\210\227/\351\233\206\345\220\210\345\210\222\345\210\206.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -568,6 +568,6 @@ boolean backtrack(int k, int bucket, **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/LRU\347\256\227\346\263\225.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/LRU\347\256\227\346\263\225.md" index 4710011e8cdb2daf58fedfd7553707e61c188ad3..0bd9bf33b4695678dfa8f5977a0d8144f11adaa4 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/LRU\347\256\227\346\263\225.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/LRU\347\256\227\346\263\225.md" @@ -1,13 +1,5 @@ # LRU 缓存淘汰算法设计 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -350,6 +342,37 @@ class LRUCache { * [手把手带你实现 LFU 算法](https://labuladong.github.io/article/fname.html?fname=LFU) + + +


+
+引用本文的文章 + + - [一文看懂 session 和 cookie](https://labuladong.github.io/article/fname.html?fname=session和cookie) + - [常数时间删除/查找数组中的任意元素](https://labuladong.github.io/article/fname.html?fname=随机集合) + - [数据结构设计:最大栈](https://labuladong.github.io/article/fname.html?fname=最大栈) + - [算法就像搭乐高:带你手撸 LFU 算法](https://labuladong.github.io/article/fname.html?fname=LFU) + - [算法笔试「骗分」套路](https://labuladong.github.io/article/fname.html?fname=刷题技巧) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| - | [剑指 Offer II 031. 最近最少使用缓存](https://leetcode.cn/problems/OrIXps/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/k\344\270\252\344\270\200\347\273\204\345\217\215\350\275\254\351\223\276\350\241\250.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/k\344\270\252\344\270\200\347\273\204\345\217\215\350\275\254\351\223\276\350\241\250.md" index fc18a966d773df42a185433708b58c5941deb9d7..3cead0d137715b2f17994a437c8584e6ce09e4ce 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/k\344\270\252\344\270\200\347\273\204\345\217\215\350\275\254\351\223\276\350\241\250.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/k\344\270\252\344\270\200\347\273\204\345\217\215\350\275\254\351\223\276\350\241\250.md" @@ -1,13 +1,5 @@ # 如何k个一组反转链表 - - - - - - - -

GitHub @@ -17,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -157,6 +149,34 @@ ListNode reverseKGroup(ListNode head, int k) { 那么如何分解问题、发现递归性质呢?这个只能多练习,我在数据结构精品课中讲解了 [单链表的递归实现](https://aep.h5.xeknow.com/s/1RQzXc),应该能够让你进一步加深对递归的理解。 + + +


+
+引用本文的文章 + + - [东哥带你刷二叉树(思路篇)](https://labuladong.github.io/article/fname.html?fname=二叉树系列1) + - [算法笔试「骗分」套路](https://labuladong.github.io/article/fname.html?fname=刷题技巧) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [24. Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/?show=1) | [24. 两两交换链表中的节点](https://leetcode.cn/problems/swap-nodes-in-pairs/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\270\200\350\241\214\344\273\243\347\240\201\350\247\243\345\206\263\347\232\204\346\231\272\345\212\233\351\242\230.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\270\200\350\241\214\344\273\243\347\240\201\350\247\243\345\206\263\347\232\204\346\231\272\345\212\233\351\242\230.md" index d46dc767e877307ab626bcf75918a494c5933874..b6a4e96e0b83d238ad86c3deb5356b25373652fd 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\270\200\350\241\214\344\273\243\347\240\201\350\247\243\345\206\263\347\232\204\346\231\272\345\212\233\351\242\230.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\270\200\350\241\214\344\273\243\347\240\201\350\247\243\345\206\263\347\232\204\346\231\272\345\212\233\351\242\230.md" @@ -1,11 +1,5 @@ # 一行代码就能解决的算法题 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -147,6 +141,22 @@ int bulbSwitch(int n) { 就算有的 `n` 平方根结果是小数,强转成 int 型,也相当于一个最大整数上界,比这个上界小的所有整数,平方后的索引都是最后亮着的灯的索引。所以说我们直接把平方根转成整数,就是这个问题的答案。 + + +


+
+引用本文的文章 + + - [丑数系列算法详解](https://labuladong.github.io/article/fname.html?fname=丑数) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + - [经典动态规划:博弈问题](https://labuladong.github.io/article/fname.html?fname=动态规划之博弈问题) + +

+ + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\345\210\244\345\256\232\345\255\220\345\272\217\345\210\227.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\345\210\244\345\256\232\345\255\220\345\272\217\345\210\227.md" index efe18606b2c66e4d14baea4b8f0532d14e458b94..e80766bd40cb2640de52f36dfaaf8c13c35a0540 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\345\210\244\345\256\232\345\255\220\345\272\217\345\210\227.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\346\237\245\346\211\276\345\210\244\345\256\232\345\255\220\345\272\217\345\210\227.md" @@ -1,11 +1,5 @@ # 二分查找高效判定子序列 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -232,6 +226,10 @@ int left_bound(ArrayList arr, int target) { } ``` + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\350\277\220\347\224\250.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\350\277\220\347\224\250.md" index 5eb132beb5397f24826e73d3bb83fc5995beab51..3ee95ca877745a477b0dc1fdf50bf2e788c234c5 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\350\277\220\347\224\250.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\344\272\214\345\210\206\350\277\220\347\224\250.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\210\244\346\226\255\345\233\236\346\226\207\351\223\276\350\241\250.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\210\244\346\226\255\345\233\236\346\226\207\351\223\276\350\241\250.md" index 6a3da5d1f27912b461a6b2f0c90602d2069092ad..f92931d3066db22f291e8ce5fa9a9f6f1f1e5cfb 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\210\244\346\226\255\345\233\236\346\226\207\351\223\276\350\241\250.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\210\244\346\226\255\345\233\236\346\226\207\351\223\276\350\241\250.md" @@ -1,11 +1,5 @@ # 如何高效判断回文链表 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -267,6 +261,23 @@ p.next = reverse(q); > 最后打个广告,我亲自制作了一门 [数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO),以视频课为主,手把手带你实现常用的数据结构及相关算法,旨在帮助算法基础较为薄弱的读者深入理解常用数据结构的底层原理,在算法学习中少走弯路。 + + + +


+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| - | [剑指 Offer II 027. 回文链表](https://leetcode.cn/problems/aMhZSa/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\215\344\272\272\351\227\256\351\242\230.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\215\344\272\272\351\227\256\351\242\230.md" index c298104debc55cbb768c0b41dff870f567027ee1..1b7433884d7f3bc541a6f87bf905eca21123a4b8 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\215\344\272\272\351\227\256\351\242\230.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\215\344\272\272\351\227\256\351\242\230.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -269,6 +269,6 @@ int findCelebrity(int n) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\255\220\351\233\206\346\216\222\345\210\227\347\273\204\345\220\210.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\255\220\351\233\206\346\216\222\345\210\227\347\273\204\345\220\210.md" index f14d864d28cff2290045804e2e45496302b1f6de..5fb6dc84e4fea88ce7c16451f1c97be52c45053f 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\255\220\351\233\206\346\216\222\345\210\227\347\273\204\345\220\210.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\255\220\351\233\206\346\216\222\345\210\227\347\273\204\345\220\210.md" @@ -1,11 +1,5 @@ # 一文秒杀所有排列组合子集问题 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -924,6 +918,43 @@ void backtrack(int[] nums) { 如果你能够看到这里,真得给你鼓掌,相信你以后遇到各种乱七八糟的算法题,也能一眼看透它们的本质,以不变应万变。另外,考虑到篇幅,本文并没有对这些算法进行复杂度的分析,你可以使用我在 [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) 讲到的复杂度分析方法尝试自己分析它们的复杂度。 + + +


+
+引用本文的文章 + + - [两种思路解决单词拼接问题](https://labuladong.github.io/article/fname.html?fname=单词拼接) + - [分治算法详解:运算优先级](https://labuladong.github.io/article/fname.html?fname=分治算法) + - [回溯算法解题套路框架](https://labuladong.github.io/article/fname.html?fname=回溯算法详解修订版) + - [我的刷题心得](https://labuladong.github.io/article/fname.html?fname=算法心得) + - [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [17. Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/?show=1) | [17. 电话号码的字母组合](https://leetcode.cn/problems/letter-combinations-of-a-phone-number/?show=1) | +| [491. Increasing Subsequences](https://leetcode.com/problems/increasing-subsequences/?show=1) | [491. 递增子序列](https://leetcode.cn/problems/increasing-subsequences/?show=1) | +| - | [剑指 Offer 38. 字符串的排列](https://leetcode.cn/problems/zi-fu-chuan-de-pai-lie-lcof/?show=1) | +| - | [剑指 Offer II 079. 所有子集](https://leetcode.cn/problems/TVdhkn/?show=1) | +| - | [剑指 Offer II 080. 含有 k 个元素的组合](https://leetcode.cn/problems/uUsW3B/?show=1) | +| - | [剑指 Offer II 081. 允许重复选择元素的组合](https://leetcode.cn/problems/Ygoe9J/?show=1) | +| - | [剑指 Offer II 083. 没有重复元素集合的全排列](https://leetcode.cn/problems/VvJkup/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\256\211\346\216\222\344\274\232\350\256\256\345\256\244.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\256\211\346\216\222\344\274\232\350\256\256\345\256\244.md" index 89b1b3171aeeeb5d526103b0ffd3aed57fe43b09..4e2a7ab69170eeda8ca1bd877419593db8f218cb 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\256\211\346\216\222\344\274\232\350\256\256\345\256\244.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\256\211\346\216\222\344\274\232\350\256\256\345\256\244.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -197,6 +197,6 @@ int minMeetingRooms(int[][] meetings) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\262\233\345\261\277\351\242\230\347\233\256.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\262\233\345\261\277\351\242\230\347\233\256.md" index 85b30e811c780b3b2755988c39287f918b7b264d..0ea057e64741e8191450e3d232de22a91dffac92 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\262\233\345\261\277\351\242\230\347\233\256.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\262\233\345\261\277\351\242\230\347\233\256.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -529,6 +529,6 @@ int numDistinctIslands(int[][] grid) { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png) \ No newline at end of file diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\272\247\344\275\215\350\260\203\345\272\246.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\272\247\344\275\215\350\260\203\345\272\246.md" index 105bccef765085d0b8ff8231b96b6f3812ca5981..327b8d68b53029163d973a4391a9591bca509bcd 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\272\247\344\275\215\350\260\203\345\272\246.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\272\247\344\275\215\350\260\203\345\272\246.md" @@ -1,11 +1,5 @@ # 如何调度考生的座位 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -230,6 +224,10 @@ private int distance(int[] intv) { 希望本文对大家有帮助。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\211\223\345\215\260\347\264\240\346\225\260.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\211\223\345\215\260\347\264\240\346\225\260.md" index 8ad84f7397b1e63168f6f9fdde72a0425152300a..2cf1e0a4b42875ee691e3e76d35e87d2b082741d 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\211\223\345\215\260\347\264\240\346\225\260.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\211\223\345\215\260\347\264\240\346\225\260.md" @@ -1,11 +1,5 @@ # 如何高效寻找素数 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -180,6 +174,33 @@ int countPrimes(int n) { 以上就是素数算法相关的全部内容。怎么样,是不是看似简单的问题却有不少细节可以打磨呀? + + +


+
+引用本文的文章 + + - [丑数系列算法详解](https://labuladong.github.io/article/fname.html?fname=丑数) + +

+ + + + +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [264. Ugly Number II](https://leetcode.com/problems/ugly-number-ii/?show=1) | [264. 丑数 II](https://leetcode.cn/problems/ugly-number-ii/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\216\245\351\233\250\346\260\264.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\216\245\351\233\250\346\260\264.md" index 8a7b6f61113105d1b5e63e112960a5e5259875d2..3ad805d92a1e1b9a00d6e3c164815928269a3475 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\216\245\351\233\250\346\260\264.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\216\245\351\233\250\346\260\264.md" @@ -1,11 +1,7 @@ # 接雨水问题详解 - + - - - -

GitHub @@ -15,7 +11,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -280,6 +276,10 @@ if (height[left] < height[right]) { 至此,这道题也解决了。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\260\264\345\241\230\346\212\275\346\240\267.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\260\264\345\241\230\346\212\275\346\240\267.md" index 574bef3d808e6cc9eee723591b52c5402a9996a9..1ecb4f447fb04997fee64b663d06edb33b086399 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\260\264\345\241\230\346\212\275\346\240\267.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\346\260\264\345\241\230\346\212\275\346\240\267.md" @@ -1,11 +1,5 @@ # 随机算法之水塘抽样算法 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -130,6 +124,10 @@ int[] getRandom(ListNode head, int k) { 答案见 [我的这篇文章](https://labuladong.github.io/article/fname.html?fname=随机集合)。 + + + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\347\274\272\345\244\261\345\222\214\351\207\215\345\244\215\347\232\204\345\205\203\347\264\240.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\347\274\272\345\244\261\345\222\214\351\207\215\345\244\215\347\232\204\345\205\203\347\264\240.md" index c6a76307f7e4c10a71649ac4494153eae8f5ab19..baf9b8c07fa58608d86bfcf0bd45df7b773370fe 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\347\274\272\345\244\261\345\222\214\351\207\215\345\244\215\347\232\204\345\205\203\347\264\240.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\347\274\272\345\244\261\345\222\214\351\207\215\345\244\215\347\232\204\345\205\203\347\264\240.md" @@ -1,11 +1,5 @@ # 如何寻找缺失和重复的元素 - - - - - -

GitHub @@ -15,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -134,6 +128,24 @@ int[] findErrorNums(int[] nums) { 异或运算也是常用的,因为异或性质 `a ^ a = 0, a ^ 0 = a`,如果将索引和元素同时异或,就可以消除成对儿的索引和元素,留下的就是重复或者缺失的元素。可以看看前文 [常用的位运算](https://labuladong.github.io/article/fname.html?fname=常用的位操作),介绍过这种方法。 + + + +


+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://mp.weixin.qq.com/s/X-fE9sR4BLi6T9pn7xP4pg) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [442. Find All Duplicates in an Array](https://leetcode.com/problems/find-all-duplicates-in-an-array/?show=1) | [442. 数组中重复的数据](https://leetcode.cn/problems/find-all-duplicates-in-an-array/?show=1) | +| [448. Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/?show=1) | [448. 找到所有数组中消失的数字](https://leetcode.cn/problems/find-all-numbers-disappeared-in-an-array/?show=1) | + +
+ + + **_____________** **《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\351\232\217\346\234\272\346\235\203\351\207\215.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\351\232\217\346\234\272\346\235\203\351\207\215.md" index f89fdc28a1ea5aa67b5b9a910f337614376cfbdb..5c03e74fce91c03c366a9d94229b9ce6651f64d1 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\351\232\217\346\234\272\346\235\203\351\207\215.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\351\232\217\346\234\272\346\235\203\351\207\215.md" @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/algo/images/souyisou1.png) -**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V1.9,[第 11 期刷题打卡挑战(9/19 开始)](https://mp.weixin.qq.com/s/eUG2OOzY3k_ZTz-CFvtv5Q) 开始报名。另外,建议你在我的 [网站](https://labuladong.github.io/algo/) 学习文章,体验更好。** +**通知:[数据结构精品课](https://aep.h5.xeknow.com/s/1XJHEO) 已更新到 V2.0,第 12 期刷题打卡 [开始报名](https://aep.xet.tech/s/XhcRc),点击这里体验 [刷题全家桶](https://labuladong.gitee.io/algo/images/others/%E5%85%A8%E5%AE%B6%E6%A1%B6.jpg)。另外,建议你在我的 [网站](https://labuladong.gitee.io/algo/) 学习文章,体验更好。** @@ -58,7 +58,7 @@ 前文 [设计随机删除元素的数据结构](https://labuladong.github.io/article/fname.html?fname=随机集合) 主要考察的是数据结构的使用,每次把元素移到数组尾部再删除,可以避免数据搬移。 -前文 [无限序列中随机抽取元素](https://labuladong.github.io/article/fname.html?fname=水塘抽样) 讲的是经典的「水塘抽样算法」,运用简单的数学运算,在无限序列中等概率选取元素。 +前文 [谈谈游戏中的随机算法](https://labuladong.github.io/article/fname.html?fname=随机算法) 讲的是经典的「水塘抽样算法」,运用简单的数学运算,在无限序列中等概率选取元素。 前文 [算法笔试技巧](https://labuladong.github.io/article/fname.html?fname=刷题技巧) 中我还分享过一个巧用概率最大化测试用例通过率的骗分技巧。 @@ -210,7 +210,8 @@ class Solution {
引用本文的文章 - - [如何在无限序列中随机抽取元素](https://labuladong.github.io/article/fname.html?fname=水塘抽样) + - [谈谈游戏中的随机算法](https://labuladong.github.io/article/fname.html?fname=随机算法) + - [随机算法之水塘抽样算法](https://labuladong.github.io/article/fname.html?fname=水塘抽样)

@@ -220,6 +221,6 @@ class Solution { **_____________** -**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「进群」可加入算法群;回复「PDF」可获取精华文章 PDF**: +**《labuladong 的算法小抄》已经出版,关注公众号查看详情;后台回复关键词「**进群**」可加入算法群;回复「**全家桶**」可下载配套 PDF 和刷题全家桶**: ![](https://labuladong.github.io/algo/images/souyisou2.png)