From d2c4a77e495c1fec47fba91689a1da23e9ae9690 Mon Sep 17 00:00:00 2001 From: labuladong Date: Mon, 25 Mar 2024 23:02:38 +0800 Subject: [PATCH] update content --- README.md | 79 +++++++++++--------- 动态规划系列/LCS.md | 2 +- 动态规划系列/动态规划之KMP字符匹配算法.md | 2 +- 动态规划系列/动态规划之博弈问题.md | 2 +- 动态规划系列/动态规划之四键键盘.md | 2 +- 动态规划系列/动态规划之正则表达.md | 2 +- 动态规划系列/动态规划设计:最长递增子序列.md | 11 +-- 动态规划系列/动态规划详解进阶.md | 2 +- 动态规划系列/单词拼接.md | 2 +- 动态规划系列/团灭股票问题.md | 2 +- 动态规划系列/子序列问题模板.md | 2 +- 动态规划系列/抢房子.md | 2 +- 动态规划系列/最优子结构.md | 2 +- 动态规划系列/状态压缩技巧.md | 2 +- 动态规划系列/编辑距离.md | 4 +- 动态规划系列/背包问题.md | 18 ++++- 动态规划系列/贪心算法之区间调度问题.md | 2 +- 动态规划系列/高楼扔鸡蛋问题.md | 4 +- 动态规划系列/魔塔.md | 2 +- 技术/linuxshell.md | 4 +- 技术/linux进程.md | 6 +- 技术/redis入侵.md | 2 +- 技术/session和cookie.md | 2 +- 技术/刷题技巧.md | 2 +- 技术/在线练习平台.md | 4 +- 技术/密码技术.md | 2 +- 数据结构系列/BST1.md | 14 +--- 数据结构系列/BST2.md | 7 +- 数据结构系列/dijkstra算法.md | 2 +- 数据结构系列/二叉堆详解实现优先级队列.md | 3 +- 数据结构系列/二叉树总结.md | 8 +- 数据结构系列/二叉树系列1.md | 12 +-- 数据结构系列/二叉树系列2.md | 6 +- 数据结构系列/单调栈.md | 6 +- 数据结构系列/单调队列.md | 2 +- 数据结构系列/图.md | 2 +- 数据结构系列/实现计算器.md | 2 +- 数据结构系列/拓扑排序.md | 2 +- 数据结构系列/设计Twitter.md | 4 +- 数据结构系列/递归反转链表的一部分.md | 2 +- 数据结构系列/队列实现栈栈实现队列.md | 2 +- 算法思维系列/BFS框架.md | 2 +- 算法思维系列/BFS解决滑动拼图.md | 2 +- 算法思维系列/UnionFind算法详解.md | 2 +- 算法思维系列/二分查找详解.md | 8 +- 算法思维系列/几个反直觉的概率问题.md | 2 +- 算法思维系列/前缀和技巧.md | 2 +- 算法思维系列/双指针技巧.md | 2 +- 算法思维系列/回溯算法详解修订版.md | 5 +- 算法思维系列/字符串乘法.md | 2 +- 算法思维系列/学习数据结构和算法的高效方法.md | 12 +-- 算法思维系列/差分技巧.md | 4 +- 算法思维系列/常用的位操作.md | 2 +- 算法思维系列/洗牌算法.md | 2 +- 算法思维系列/滑动窗口技巧进阶.md | 75 ++++++++++++------- 算法思维系列/烧饼排序.md | 2 +- 算法思维系列/花式遍历.md | 5 +- 算法思维系列/集合划分.md | 18 ++--- 高频面试系列/LRU算法.md | 4 +- 高频面试系列/k个一组反转链表.md | 2 +- 高频面试系列/一行代码解决的智力题.md | 2 +- 高频面试系列/二分查找判定子序列.md | 2 +- 高频面试系列/二分运用.md | 2 +- 高频面试系列/判断回文链表.md | 5 +- 高频面试系列/名人问题.md | 2 +- 高频面试系列/子集排列组合.md | 3 +- 高频面试系列/安排会议室.md | 32 +++++++- 高频面试系列/岛屿题目.md | 2 +- 高频面试系列/座位调度.md | 2 +- 高频面试系列/打印素数.md | 2 +- 高频面试系列/接雨水.md | 2 +- 高频面试系列/缺失和重复的元素.md | 2 +- 高频面试系列/随机权重.md | 2 +- 73 files changed, 246 insertions(+), 207 deletions(-) diff --git a/README.md b/README.md index 01039e8..39720a9 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,9 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [配套 Chrome 刷题插件](https://labuladong.github.io/article/fname.html?fname=chrome插件简介) * [配套 vscode 刷题插件](https://labuladong.github.io/article/fname.html?fname=vscode插件简介) * [配套 JetBrains 刷题插件](https://labuladong.github.io/article/fname.html?fname=jb插件简介) - * [数据结构精品课](https://labuladong.github.io/article/fname.html?fname=ds课程简介) - * [二叉树递归专题课](https://labuladong.github.io/article/fname.html?fname=tree课程简介) - * [30 天刷题打卡挑战](https://labuladong.github.io/article/fname.html?fname=打卡挑战简介) * [使用可视化面板的 JavaScript 基础](https://labuladong.github.io/article/fname.html?fname=面板js基础) * [学习本站所需的 Java 基础](https://labuladong.github.io/article/fname.html?fname=网站Java基础) + * [30 天刷题打卡挑战(可选)](https://labuladong.github.io/article/fname.html?fname=打卡挑战简介) ### [第零章、核心框架汇总](https://labuladong.github.io/algo/) * [学习算法和刷题的框架思维](https://labuladong.github.io/article/fname.html?fname=学习数据结构和算法的高效方法) @@ -158,25 +156,31 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 ### [第一章、手把手刷数据结构](https://labuladong.github.io/algo/) * [手把手刷链表算法](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=递归反转链表的一部分) * [如何 K 个一组反转链表](https://labuladong.github.io/article/fname.html?fname=k个一组反转链表) * [如何判断回文链表](https://labuladong.github.io/article/fname.html?fname=判断回文链表) * [手把手刷数组算法](https://labuladong.github.io/algo/) * [双指针技巧秒杀七道数组题目](https://labuladong.github.io/article/fname.html?fname=双指针技巧) + * [【强化练习】数组双指针经典习题](https://labuladong.github.io/article/fname.html?fname=数组双指针习题) * [一个方法团灭 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://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=滑动窗口习题) * [滑动窗口算法延伸:Rabin Karp 字符匹配算法](https://labuladong.github.io/article/fname.html?fname=rabinkarp) * [我写了首诗,让你闭着眼睛也能写对二分搜索](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/algo/) * [东哥带你刷二叉树(纲领篇)](https://labuladong.github.io/article/fname.html?fname=二叉树总结) * [东哥带你刷二叉树(思路篇)](https://labuladong.github.io/article/fname.html?fname=二叉树系列1) @@ -192,6 +196,41 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [Git原理之最近公共祖先](https://labuladong.github.io/article/fname.html?fname=公共祖先) * [如何计算完全二叉树的节点数](https://labuladong.github.io/article/fname.html?fname=完全二叉树节点数) + * [【递归专项】手把手带你刷 100 道二叉树](https://labuladong.github.io/algo/) + * [用「遍历」思维解题 I](https://labuladong.github.io/article/fname.html?fname=习题遍历1) + * [用「遍历」思维解题 II](https://labuladong.github.io/article/fname.html?fname=习题遍历2) + * [用「遍历」思维解题 III](https://labuladong.github.io/article/fname.html?fname=习题遍历3) + * [用「分解问题」思维解题 I](https://labuladong.github.io/article/fname.html?fname=习题分解问题1) + * [用「分解问题」思维解题 II](https://labuladong.github.io/article/fname.html?fname=习题分解问题2) + * [同时运用两种思维解题](https://labuladong.github.io/article/fname.html?fname=习题综合两种) + * [利用后序位置解题 I](https://labuladong.github.io/article/fname.html?fname=习题后序1) + * [利用后序位置解题 II](https://labuladong.github.io/article/fname.html?fname=习题后序2) + * [利用后序位置解题 III](https://labuladong.github.io/article/fname.html?fname=习题后序3) + * [运用层序遍历解题 I](https://labuladong.github.io/article/fname.html?fname=习题层序1) + * [运用层序遍历解题 II](https://labuladong.github.io/article/fname.html?fname=习题层序2) + * [二叉搜索树经典例题 I](https://labuladong.github.io/article/fname.html?fname=习题搜索树1) + * [二叉搜索树经典例题 II](https://labuladong.github.io/article/fname.html?fname=习题搜索树2) + + + * [手把手设计数据结构](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=单调栈习题) + * [单调队列结构解决滑动窗口问题](https://labuladong.github.io/article/fname.html?fname=单调队列) + * [【强化练习】单调队列的通用实现及经典习题](https://labuladong.github.io/article/fname.html?fname=单调队列习题) + * [算法就像搭乐高:带你手撸 LRU 算法](https://labuladong.github.io/article/fname.html?fname=LRU算法) + * [算法就像搭乐高:带你手撸 LFU 算法](https://labuladong.github.io/article/fname.html?fname=LFU) + * [【强化练习】哈希表更多习题](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=数据流中位数) + * [二叉堆详解实现优先级队列](https://labuladong.github.io/article/fname.html?fname=二叉堆详解实现优先级队列) + * [【强化练习】优先级队列经典习题](https://labuladong.github.io/article/fname.html?fname=二叉堆习题) + * [设计朋友圈时间线功能](https://labuladong.github.io/article/fname.html?fname=设计Twitter) + * [【强化练习】更多经典设计习题](https://labuladong.github.io/article/fname.html?fname=设计习题) + + * [手把手刷图算法](https://labuladong.github.io/algo/) * [图论基础及遍历算法](https://labuladong.github.io/article/fname.html?fname=图) * [众里寻他千百度:名流问题](https://labuladong.github.io/article/fname.html?fname=名人问题) @@ -202,16 +241,6 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [Prim 最小生成树算法](https://labuladong.github.io/article/fname.html?fname=prim算法) * [Dijkstra 算法模板及应用](https://labuladong.github.io/article/fname.html?fname=dijkstra算法) - * [手把手设计数据结构](https://labuladong.github.io/algo/) - * [单调栈结构解决三道算法题](https://labuladong.github.io/article/fname.html?fname=单调栈) - * [单调队列结构解决滑动窗口问题](https://labuladong.github.io/article/fname.html?fname=单调队列) - * [算法就像搭乐高:带你手撸 LRU 算法](https://labuladong.github.io/article/fname.html?fname=LRU算法) - * [算法就像搭乐高:带你手撸 LFU 算法](https://labuladong.github.io/article/fname.html?fname=LFU) - * [前缀树算法模板秒杀五道算法题](https://labuladong.github.io/article/fname.html?fname=trie) - * [一道求中位数的算法题把我整不会了](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=设计Twitter) ### [第二章、手把手刷动态规划](https://labuladong.github.io/algo/) * [动态规划基本技巧](https://labuladong.github.io/algo/) @@ -234,7 +263,7 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [经典动态规划:0-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=targetSum) + * [目标和问题:背包问题的变体](https://labuladong.github.io/article/fname.html?fname=targetSum) * [用动态规划玩游戏](https://labuladong.github.io/algo/) * [动态规划之最小路径和](https://labuladong.github.io/article/fname.html?fname=最小路径和) @@ -257,7 +286,7 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [如何运用贪心思想玩跳跃游戏](https://labuladong.github.io/article/fname.html?fname=跳跃游戏) ### [第三章、必知必会算法技巧](https://labuladong.github.io/algo/) - * [暴力搜索算法](https://labuladong.github.io/algo/) + * [经典暴力搜索算法](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=集合划分) @@ -289,24 +318,6 @@ PDF 共两本,一本《labuladong 的算法秘籍》类似教材,帮你系 * [如何高效解决接雨水问题](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/algo/) - * [Linux 文件系统都是什么鬼](https://labuladong.github.io/article/fname.html?fname=linux文件系统) - * [Linux 的进程/线程/文件描述符是什么](https://labuladong.github.io/article/fname.html?fname=linux进程) - * [关于 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=密码技术) - * [我用四个命令概括了 Git 的所有套路](https://labuladong.github.io/article/fname.html?fname=git常用命令) - * [Git/SQL/正则表达式的在线练习平台](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=炸弹人游戏) - * [学习开源项目,告别 CRUD](https://labuladong.github.io/article/fname.html?fname=参与开源) - * [如何学习开源项目,我又总结了套路](https://labuladong.github.io/article/fname.html?fname=调试技巧) diff --git a/动态规划系列/LCS.md b/动态规划系列/LCS.md index cac30e7..47b63b5 100644 --- a/动态规划系列/LCS.md +++ b/动态规划系列/LCS.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/动态规划之KMP字符匹配算法.md b/动态规划系列/动态规划之KMP字符匹配算法.md index d435a3f..bd9d1b4 100644 --- a/动态规划系列/动态规划之KMP字符匹配算法.md +++ b/动态规划系列/动态规划之KMP字符匹配算法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/动态规划之博弈问题.md b/动态规划系列/动态规划之博弈问题.md index 84a5cf0..33b4ef8 100644 --- a/动态规划系列/动态规划之博弈问题.md +++ b/动态规划系列/动态规划之博弈问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/动态规划之四键键盘.md b/动态规划系列/动态规划之四键键盘.md index bc5cb95..d49af97 100644 --- a/动态规划系列/动态规划之四键键盘.md +++ b/动态规划系列/动态规划之四键键盘.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/动态规划之正则表达.md b/动态规划系列/动态规划之正则表达.md index 0323b06..bf16de7 100644 --- a/动态规划系列/动态规划之正则表达.md +++ b/动态规划系列/动态规划之正则表达.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/动态规划设计:最长递增子序列.md b/动态规划系列/动态规划设计:最长递增子序列.md index e41882e..5bdf310 100644 --- a/动态规划系列/动态规划设计:最长递增子序列.md +++ b/动态规划系列/动态规划设计:最长递增子序列.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -278,12 +278,9 @@ int lengthOfLIS(int[] nums) { public int maxEnvelopes(int[][] envelopes) { int n = envelopes.length; // 按宽度升序排列,如果宽度一样,则按高度降序排列 - Arrays.sort(envelopes, new Comparator() - { - public int compare(int[] a, int[] b) { - return a[0] == b[0] ? - b[1] - a[1] : a[0] - b[0]; - } + Arrays.sort(envelopes, (int[] a, int[] b) -> { + return a[0] == b[0] ? + b[1] - a[1] : a[0] - b[0]; }); // 对高度数组寻找 LIS int[] height = new int[n]; diff --git a/动态规划系列/动态规划详解进阶.md b/动态规划系列/动态规划详解进阶.md index 2e84b6c..2a44920 100644 --- a/动态规划系列/动态规划详解进阶.md +++ b/动态规划系列/动态规划详解进阶.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/单词拼接.md b/动态规划系列/单词拼接.md index 979f730..d1d7a70 100644 --- a/动态规划系列/单词拼接.md +++ b/动态规划系列/单词拼接.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/团灭股票问题.md b/动态规划系列/团灭股票问题.md index 5d89c2b..c60f73c 100644 --- a/动态规划系列/团灭股票问题.md +++ b/动态规划系列/团灭股票问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/子序列问题模板.md b/动态规划系列/子序列问题模板.md index 5dc8260..8e67cc1 100644 --- a/动态规划系列/子序列问题模板.md +++ b/动态规划系列/子序列问题模板.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/抢房子.md b/动态规划系列/抢房子.md index cc9cd10..e3c7062 100644 --- a/动态规划系列/抢房子.md +++ b/动态规划系列/抢房子.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/最优子结构.md b/动态规划系列/最优子结构.md index 41d8d30..85b665e 100644 --- a/动态规划系列/最优子结构.md +++ b/动态规划系列/最优子结构.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/状态压缩技巧.md b/动态规划系列/状态压缩技巧.md index 312a904..ebb06b0 100644 --- a/动态规划系列/状态压缩技巧.md +++ b/动态规划系列/状态压缩技巧.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/编辑距离.md b/动态规划系列/编辑距离.md index 3196377..b6d5a9e 100644 --- a/动态规划系列/编辑距离.md +++ b/动态规划系列/编辑距离.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -457,7 +457,7 @@ void printResult(Node[][] dp, String s1, String s2) { - [动态规划之子序列问题解题模板](https://labuladong.github.io/article/fname.html?fname=子序列问题模板) - [最优子结构原理和 dp 数组遍历方向](https://labuladong.github.io/article/fname.html?fname=最优子结构) - - [目标和:背包问题的变体](https://labuladong.github.io/article/fname.html?fname=targetSum) + - [目标和问题:背包问题的变体](https://labuladong.github.io/article/fname.html?fname=targetSum)
diff --git a/动态规划系列/背包问题.md b/动态规划系列/背包问题.md index f66ff79..9a4ebcc 100644 --- a/动态规划系列/背包问题.md +++ b/动态规划系列/背包问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -180,7 +180,7 @@ int knapsack(int W, int N, int[] wt, int[] val) { - [扫描线技巧:安排会议室](https://labuladong.github.io/article/fname.html?fname=安排会议室) - [球盒模型:回溯算法穷举的两种视角](https://labuladong.github.io/article/fname.html?fname=集合划分) - - [目标和:背包问题的变体](https://labuladong.github.io/article/fname.html?fname=targetSum) + - [目标和问题:背包问题的变体](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=背包零钱) @@ -189,6 +189,20 @@ int knapsack(int W, int N, int[] wt, int[] val) { +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://labuladong.github.io/article/fname.html?fname=chrome插件简介) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1235. Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling/?show=1) | [1235. 规划兼职工作](https://leetcode.cn/problems/maximum-profit-in-job-scheduling/?show=1) | + +
+
+ + **_____________** diff --git a/动态规划系列/贪心算法之区间调度问题.md b/动态规划系列/贪心算法之区间调度问题.md index e679947..1c3b045 100644 --- a/动态规划系列/贪心算法之区间调度问题.md +++ b/动态规划系列/贪心算法之区间调度问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/动态规划系列/高楼扔鸡蛋问题.md b/动态规划系列/高楼扔鸡蛋问题.md index 2e74f6a..990d019 100644 --- a/动态规划系列/高楼扔鸡蛋问题.md +++ b/动态规划系列/高楼扔鸡蛋问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -73,8 +73,8 @@
引用本文的文章 - - [二分搜索怎么用?我又总结了套路](https://labuladong.github.io/article/fname.html?fname=二分运用) - [动态规划穷举的两种视角](https://labuladong.github.io/article/fname.html?fname=动归两种视角) + - [实际二分搜索时的思维框架](https://labuladong.github.io/article/fname.html?fname=二分运用) - [最优子结构原理和 dp 数组遍历方向](https://labuladong.github.io/article/fname.html?fname=最优子结构) - [经典动态规划:戳气球](https://labuladong.github.io/article/fname.html?fname=扎气球) diff --git a/动态规划系列/魔塔.md b/动态规划系列/魔塔.md index b1f45dc..fa67754 100644 --- a/动态规划系列/魔塔.md +++ b/动态规划系列/魔塔.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/技术/linuxshell.md b/技术/linuxshell.md index 0badb9b..fb16db5 100644 --- a/技术/linuxshell.md +++ b/技术/linuxshell.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -350,7 +350,7 @@ tail | grep '下一篇' $filename
引用本文的文章 - - [Linux 管道和重定向的坑](https://labuladong.github.io/article/fname.html?fname=linux技巧3) + - [Linux 管道符的坑](https://labuladong.github.io/article/fname.html?fname=linux技巧3)

diff --git a/技术/linux进程.md b/技术/linux进程.md index 92f73f4..f144571 100644 --- a/技术/linux进程.md +++ b/技术/linux进程.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -140,8 +140,8 @@ $ cmd1 | cmd2 | cmd3
引用本文的文章 - - [Linux 管道和重定向的坑](https://labuladong.github.io/article/fname.html?fname=linux技巧3) - - [关于 Linux shell 你必须知道的](https://labuladong.github.io/article/fname.html?fname=linuxshell) + - [Linux 管道符的坑](https://labuladong.github.io/article/fname.html?fname=linux技巧3) + - [关于 Linux shell 你必须知道的技巧](https://labuladong.github.io/article/fname.html?fname=linuxshell)

diff --git a/技术/redis入侵.md b/技术/redis入侵.md index e052027..8185496 100644 --- a/技术/redis入侵.md +++ b/技术/redis入侵.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/技术/session和cookie.md b/技术/session和cookie.md index 3d429d3..dc65ea3 100644 --- a/技术/session和cookie.md +++ b/技术/session和cookie.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/技术/刷题技巧.md b/技术/刷题技巧.md index 65cd307..75299b9 100644 --- a/技术/刷题技巧.md +++ b/技术/刷题技巧.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/技术/在线练习平台.md b/技术/在线练习平台.md index 3a46fa8..507ad6e 100644 --- a/技术/在线练习平台.md +++ b/技术/在线练习平台.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -113,7 +113,7 @@ https://sqlzoo.net/
引用本文的文章 - - [我用四个命令概括了 Git 的所有套路](https://labuladong.github.io/article/fname.html?fname=git常用命令) + - [四个基本命令搞会 Git 使用](https://labuladong.github.io/article/fname.html?fname=git常用命令)

diff --git a/技术/密码技术.md b/技术/密码技术.md index 615e7d6..4b30036 100644 --- a/技术/密码技术.md +++ b/技术/密码技术.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/BST1.md b/数据结构系列/BST1.md index d4bfef8..5368825 100644 --- a/数据结构系列/BST1.md +++ b/数据结构系列/BST1.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -24,13 +24,6 @@ **-----------** -> tip:本文有视频版:[动手实现 TreeMap](https://labuladong.online/algo/ds-class/dong-shou--60928/treemap-yu-a003e/)。 - - - - -> info:在开头先打个广告,我的 [手把手刷二叉树课程](https://labuladong.online/algo/tree-class/) 按照公式和套路讲解了 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。 @@ -237,9 +230,7 @@ void traverse(TreeNode root) { 简单总结下吧,BST 相关的问题,要么利用 BST 左小右大的特性提升算法效率,要么利用中序遍历的特性满足题目的要求,也就这么些事儿吧。 -当然,BST 还可以玩出更多花样,提供更丰富的 API,更多内容参见我的数据结构课程中的 [动手实现 TreeMap](https://labuladong.online/algo/ds-class/dong-shou--60928/treemap-yu-a003e/) 章节。 - -本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见 [手把手带你刷通二叉树](https://labuladong.online/algo/tree-class/)。 +本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见二叉树章节中的 [递归专项练习](https://labuladong.github.io/article/fname.html?fname=习题搜索树1) @@ -247,6 +238,7 @@ void traverse(TreeNode root) {
引用本文的文章 + - [【强化练习】优先级队列经典习题](https://labuladong.github.io/article/fname.html?fname=二叉堆习题) - [东哥带你刷二叉搜索树(基操篇)](https://labuladong.github.io/article/fname.html?fname=BST2) - [东哥带你刷二叉搜索树(构造篇)](https://labuladong.github.io/article/fname.html?fname=BST3) - [二叉树的递归转迭代的代码框架](https://labuladong.github.io/article/fname.html?fname=迭代遍历二叉树) diff --git a/数据结构系列/BST2.md b/数据结构系列/BST2.md index dae7b8d..799011b 100644 --- a/数据结构系列/BST2.md +++ b/数据结构系列/BST2.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -25,9 +25,6 @@ **-----------** -> info:在开头先打个广告,我的 [手把手刷二叉树课程](https://labuladong.online/algo/tree-class/) 按照公式和套路讲解了 150 道二叉树题目,只需一顿饭钱,就能手把手带你刷完二叉树分类的题目,迅速掌握递归思维,让你豁然开朗。我绝对有这个信心,信不信,可以等你看完我的二叉树算法系列文章再做评判。 - - 我们前文 [东哥带你刷二叉搜索树(特性篇)](https://labuladong.github.io/article/fname.html?fname=BST1) 介绍了 BST 的基本特性,还利用二叉搜索树「中序遍历有序」的特性来解决了几道题目,本文来实现 BST 的基础操作:判断 BST 的合法性、增、删、查。其中「删」和「判断合法性」略微复杂。 @@ -312,7 +309,7 @@ void BST(TreeNode root, int target) { 3、根据代码框架掌握了 BST 的增删查改操作。 -本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见 [手把手带你刷通二叉树](https://labuladong.online/algo/tree-class/)。 +本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见二叉树章节中的 [递归专项练习](https://labuladong.github.io/article/fname.html?fname=习题搜索树1) diff --git a/数据结构系列/dijkstra算法.md b/数据结构系列/dijkstra算法.md index 9cd707c..b53aaab 100644 --- a/数据结构系列/dijkstra算法.md +++ b/数据结构系列/dijkstra算法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/二叉堆详解实现优先级队列.md b/数据结构系列/二叉堆详解实现优先级队列.md index 45c3aa8..74e6d7a 100644 --- a/数据结构系列/二叉堆详解实现优先级队列.md +++ b/数据结构系列/二叉堆详解实现优先级队列.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -35,6 +35,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=设计Twitter)

diff --git a/数据结构系列/二叉树总结.md b/数据结构系列/二叉树总结.md index 343b9a7..21b4e60 100644 --- a/数据结构系列/二叉树总结.md +++ b/数据结构系列/二叉树总结.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -29,9 +29,6 @@ -> info:在开头先打个广告,我的 [手把手刷二叉树课程](https://labuladong.online/algo/tree-class/) 按照公式和套路讲解了 150 道二叉树题目,只需一顿饭钱,就能手把手带你刷完二叉树分类的题目,迅速掌握递归思维,让你豁然开朗。我绝对有这个信心,信不信,可以等你看完我的二叉树算法系列文章再做评判。 - - 我的公众号历史文章的整个脉络都是按照 [学习数据结构和算法的框架思维](https://labuladong.github.io/article/fname.html?fname=学习数据结构和算法的高效方法) 提出的框架来构建的,其中着重强调了二叉树题目的重要性,所以把本文放在第一章的必读系列中。 @@ -822,7 +819,7 @@ void levelTraverse(TreeNode root) { 希望大家能探索尽可能多的解法,只要参透二叉树这种基本数据结构的原理,那么就很容易在学习其他高级算法的道路上找到抓手,打通回路,形成闭环(手动狗头)。 -最后,我在不断完善刷题插件对二叉树系列题目的支持,在公众号后台回复关键词「**插件**」即可下载,购买我的 **[手把手刷二叉树系列课程](https://labuladong.online/algo/tree-class/)** 即可手把手带你运用本文所讲的技巧。 +最后,我在不断完善刷题插件对二叉树系列题目的支持,在公众号后台回复关键词「**插件**」即可下载,二叉树章节中的 [递归专项练习](https://labuladong.github.io/article/fname.html?fname=习题遍历1) 中会手把手带你运用本文所讲的技巧。 ::: info @@ -932,7 +929,6 @@ class Solution { - [东哥带你刷二叉树(序列化篇)](https://labuladong.github.io/article/fname.html?fname=二叉树的序列化) - [东哥带你刷二叉树(思路篇)](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=tree课程简介) - [前缀树算法模板秒杀五道算法题](https://labuladong.github.io/article/fname.html?fname=trie) - [动态规划和回溯算法的思维转换](https://labuladong.github.io/article/fname.html?fname=单词拼接) - [可视化代码编辑器使用指南](https://labuladong.github.io/article/fname.html?fname=可视化编辑器-wx) diff --git a/数据结构系列/二叉树系列1.md b/数据结构系列/二叉树系列1.md index 85b0057..0b5e4d5 100644 --- a/数据结构系列/二叉树系列1.md +++ b/数据结构系列/二叉树系列1.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -29,9 +29,6 @@ -> info:在开头先打个广告,我的 [手把手刷二叉树课程](https://labuladong.online/algo/tree-class/) 按照公式和套路讲解了 150 道二叉树题目,只需一顿饭钱,就能手把手带你刷完二叉树分类的题目,迅速掌握递归思维,让你豁然开朗。我绝对有这个信心,信不信,可以等你看完我的二叉树算法系列文章再做评判。 - - 本文承接 [东哥带你刷二叉树(纲领篇)](https://labuladong.github.io/article/fname.html?fname=二叉树总结),先复述一下前文总结的二叉树解题总纲: @@ -371,12 +368,7 @@ void flatten(TreeNode root) { 希望你能仔细体会,并运用到所有二叉树题目上。 -本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见 [手把手带你刷通二叉树](https://labuladong.online/algo/tree-class/)。 - -接下来可阅读: - -* [手把手刷二叉树(第二期)](https://labuladong.github.io/article/fname.html?fname=二叉树系列2) -* [手把手刷二叉树(第三期)](https://labuladong.github.io/article/fname.html?fname=二叉树系列3) +本文就到这里,更多经典的二叉树习题以及递归思维的训练,请参见二叉树章节中的 [递归专项练习](https://labuladong.github.io/article/fname.html?fname=习题遍历1)。 diff --git a/数据结构系列/二叉树系列2.md b/数据结构系列/二叉树系列2.md index 5b5e7ae..3bbd93e 100644 --- a/数据结构系列/二叉树系列2.md +++ b/数据结构系列/二叉树系列2.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -26,9 +26,6 @@ **-----------** -> info:在开头先打个广告,我的 [手把手刷二叉树课程](https://labuladong.online/algo/tree-class/) 按照公式和套路讲解了 150 道二叉树题目,只需一顿饭钱,就能手把手带你刷完二叉树分类的题目,迅速掌握递归思维,让你豁然开朗。我绝对有这个信心,信不信,可以等你看完我的二叉树算法系列文章再做评判。 - - 本文是承接 [东哥带你刷二叉树(纲领篇)](https://labuladong.github.io/article/fname.html?fname=二叉树总结) 的第二篇文章,先复述一下前文总结的二叉树解题总纲: @@ -589,7 +586,6 @@ int leftRootVal = preorder[preStart + 1]; - [东哥带你刷二叉搜索树(特性篇)](https://labuladong.github.io/article/fname.html?fname=BST1) - [东哥带你刷二叉树(序列化篇)](https://labuladong.github.io/article/fname.html?fname=二叉树的序列化) - - [东哥带你刷二叉树(思路篇)](https://labuladong.github.io/article/fname.html?fname=二叉树系列1) - [二叉树的递归转迭代的代码框架](https://labuladong.github.io/article/fname.html?fname=迭代遍历二叉树) - [我的刷题心得:算法的本质](https://labuladong.github.io/article/fname.html?fname=算法心得) diff --git a/数据结构系列/单调栈.md b/数据结构系列/单调栈.md index 812700a..47a3064 100644 --- a/数据结构系列/单调栈.md +++ b/数据结构系列/单调栈.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -26,7 +26,7 @@ 栈(stack)是很简单的一种数据结构,先进后出的逻辑顺序,符合某些问题的特点,比如说函数调用栈。单调栈实际上就是栈,只是利用了一些巧妙的逻辑,使得每次新元素入栈后,栈内的元素都保持有序(单调递增或单调递减)。 -听起来有点像堆(heap)?不是的,单调栈用途不太广泛,只处理一类典型的问题,比如「下一个更大元素」,「上一个更小元素」等。本文用讲解单调队列的算法模版解决「下一个更大元素」相关问题,并且探讨处理「循环数组」的策略。至于其他的变体和经典例题,我会在 [数据结构精品课](https://labuladong.online/algo/ds-class/) 中讲解。 +听起来有点像堆(heap)?不是的,单调栈用途不太广泛,只处理一类典型的问题,比如「下一个更大元素」,「上一个更小元素」等。本文用讲解单调队列的算法模版解决「下一个更大元素」相关问题,并且探讨处理「循环数组」的策略。至于其他的变体和经典例题,我会在下一篇文章 [单调栈变体和经典习题](https://labuladong.github.io/article/fname.html?fname=单调栈习题) 讲解。 ### 单调栈模板 @@ -216,6 +216,8 @@ int[] nextGreaterElements(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=单调队列题目) - [一个方法团灭 LeetCode 打家劫舍问题](https://labuladong.github.io/article/fname.html?fname=抢房子) - [一道数组去重的算法题把我整不会了](https://labuladong.github.io/article/fname.html?fname=单调栈去重) diff --git a/数据结构系列/单调队列.md b/数据结构系列/单调队列.md index 69d9b79..cadd878 100644 --- a/数据结构系列/单调队列.md +++ b/数据结构系列/单调队列.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/图.md b/数据结构系列/图.md index 77bb26d..a9430fb 100644 --- a/数据结构系列/图.md +++ b/数据结构系列/图.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/实现计算器.md b/数据结构系列/实现计算器.md index a3da6c6..08f1abe 100644 --- a/数据结构系列/实现计算器.md +++ b/数据结构系列/实现计算器.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/拓扑排序.md b/数据结构系列/拓扑排序.md index 6bd5b18..81d275f 100644 --- a/数据结构系列/拓扑排序.md +++ b/数据结构系列/拓扑排序.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/设计Twitter.md b/数据结构系列/设计Twitter.md index 2c0d28f..889fc0e 100644 --- a/数据结构系列/设计Twitter.md +++ b/数据结构系列/设计Twitter.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -229,7 +229,7 @@ class Twitter { ### 三、算法设计 -实现合并 k 个有序链表的算法需要用到优先级队列(Priority Queue),这种数据结构是「二叉堆」最重要的应用,你可以理解为它可以对插入的元素自动排序。乱序的元素插入其中就被放到了正确的位置,可以按照从小到大(或从大到小)有序地取出元素。 +实现合并 k 个有序链表的算法需要用到优先级队列(Priority Queue),这种数据结构是二叉堆最重要的应用。你可以理解为它可以对插入的元素自动排序,乱序的元素插入其中就被放到了正确的位置,可以按照从小到大(或从大到小)有序地取出元素。具体可以看这篇 [二叉树实现优先级队列](https://labuladong.github.io/article/fname.html?fname=二叉堆详解实现优先级队列) ```python PriorityQueue pq diff --git a/数据结构系列/递归反转链表的一部分.md b/数据结构系列/递归反转链表的一部分.md index a93a847..d667aad 100644 --- a/数据结构系列/递归反转链表的一部分.md +++ b/数据结构系列/递归反转链表的一部分.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/数据结构系列/队列实现栈栈实现队列.md b/数据结构系列/队列实现栈栈实现队列.md index 03c471a..b7bf2dc 100644 --- a/数据结构系列/队列实现栈栈实现队列.md +++ b/数据结构系列/队列实现栈栈实现队列.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/BFS框架.md b/算法思维系列/BFS框架.md index 2292868..6b5d125 100644 --- a/算法思维系列/BFS框架.md +++ b/算法思维系列/BFS框架.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/BFS解决滑动拼图.md b/算法思维系列/BFS解决滑动拼图.md index 2f0df21..d751254 100644 --- a/算法思维系列/BFS解决滑动拼图.md +++ b/算法思维系列/BFS解决滑动拼图.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/UnionFind算法详解.md b/算法思维系列/UnionFind算法详解.md index ddca804..4d4c80e 100644 --- a/算法思维系列/UnionFind算法详解.md +++ b/算法思维系列/UnionFind算法详解.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/二分查找详解.md b/算法思维系列/二分查找详解.md index 1bb3777..66ba085 100644 --- a/算法思维系列/二分查找详解.md +++ b/算法思维系列/二分查找详解.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -590,18 +590,19 @@ int right_bound(int[] nums, int target) { 引用本文的文章 - [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=二分查找判定子序列) - [动态规划设计:最长递增子序列](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=算法心得) - [本站简介](https://labuladong.github.io/article/fname.html?fname=home) + - [浅谈存储系统:LSM 树设计原理](https://labuladong.github.io/article/fname.html?fname=LSM树) - [用算法打败算法](https://labuladong.github.io/article/fname.html?fname=PDF中的算法) - [讲两道常考的阶乘算法题](https://labuladong.github.io/article/fname.html?fname=阶乘题目) @@ -619,6 +620,7 @@ int right_bound(int[] nums, int target) { | 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) | +| [1235. Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling/?show=1) | [1235. 规划兼职工作](https://leetcode.cn/problems/maximum-profit-in-job-scheduling/?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) | diff --git a/算法思维系列/几个反直觉的概率问题.md b/算法思维系列/几个反直觉的概率问题.md index 24dac08..26ae865 100644 --- a/算法思维系列/几个反直觉的概率问题.md +++ b/算法思维系列/几个反直觉的概率问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/前缀和技巧.md b/算法思维系列/前缀和技巧.md index 6fe724d..ab716da 100644 --- a/算法思维系列/前缀和技巧.md +++ b/算法思维系列/前缀和技巧.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/双指针技巧.md b/算法思维系列/双指针技巧.md index 8ebd9f5..a9b007f 100644 --- a/算法思维系列/双指针技巧.md +++ b/算法思维系列/双指针技巧.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/回溯算法详解修订版.md b/算法思维系列/回溯算法详解修订版.md index 2e660fc..06f427e 100644 --- a/算法思维系列/回溯算法详解修订版.md +++ b/算法思维系列/回溯算法详解修订版.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -433,8 +433,9 @@ def backtrack(...): - [学习算法和刷题的框架思维](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=targetSum) + - [目标和问题:背包问题的变体](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=刷题技巧) - [经典动态规划:戳气球](https://labuladong.github.io/article/fname.html?fname=扎气球) diff --git a/算法思维系列/字符串乘法.md b/算法思维系列/字符串乘法.md index 3090ff2..a2be4b5 100644 --- a/算法思维系列/字符串乘法.md +++ b/算法思维系列/字符串乘法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/学习数据结构和算法的高效方法.md b/算法思维系列/学习数据结构和算法的高效方法.md index f055f30..c9a6046 100644 --- a/算法思维系列/学习数据结构和算法的高效方法.md +++ b/算法思维系列/学习数据结构和算法的高效方法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -244,7 +244,7 @@ void traverse(TreeNode root, int k) { ::: tip -[刷题插件](https://mp.weixin.qq.com/s/OE1zPVPj0V2o82N4HtLQbw) 集成了手把手刷二叉树功能,按照公式和套路讲解了 150 道二叉树题目,可手把手带你刷完二叉树分类的题目,迅速掌握递归思维。 +本站的 [二叉树专项练习章节](https://labuladong.github.io/article/fname.html?fname=习题遍历1) 按照固定的公式和思维模式讲解了 150 道二叉树题目,可以手把手带你刷完二叉树分类的题目,迅速掌握递归思维。 ::: @@ -348,9 +348,6 @@ N 叉树的遍历框架,找出来了吧?你说,树这种结构重不重要 学完基本算法之后,建议从「二叉树」系列问题开始刷,结合框架思维,把树结构理解到位,然后再去看回溯、动规、分治等算法专题,对思路的理解就会更加深刻。 -> info:最后打个广告,我亲自制作了一门 [数据结构精品课](https://labuladong.online/algo/ds-class/),以视频课为主,手把手带你实现常用的数据结构及相关算法,旨在帮助算法基础较为薄弱的读者深入理解常用数据结构的底层原理,在算法学习中少走弯路。 - - @@ -364,7 +361,6 @@ N 叉树的遍历框架,找出来了吧?你说,树这种结构重不重要 - [东哥带你刷二叉树(纲领篇)](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=tree课程简介) - [前缀树算法模板秒杀五道算法题](https://labuladong.github.io/article/fname.html?fname=trie) - [可视化代码编辑器使用指南](https://labuladong.github.io/article/fname.html?fname=可视化编辑器-wx) - [回溯算法秒杀所有排列/组合/子集问题](https://labuladong.github.io/article/fname.html?fname=子集排列组合) @@ -372,12 +368,12 @@ 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=home) + - [浅谈存储系统: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=targetSum) + - [目标和问题:背包问题的变体](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=时间复杂度) - [题目不让我干什么,我偏要干什么](https://labuladong.github.io/article/fname.html?fname=nestInteger) diff --git a/算法思维系列/差分技巧.md b/算法思维系列/差分技巧.md index 56ee3e1..6837acc 100644 --- a/算法思维系列/差分技巧.md +++ b/算法思维系列/差分技巧.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -290,8 +290,6 @@ boolean carPooling(int[][] trips, int capacity) { 最后,差分数组和前缀和数组都是比较常见且巧妙的算法技巧,分别适用不同的场景,而且是会者不难,难者不会。所以,关于差分数组的使用,你学会了吗? -更多经典的数组/链表技巧习题见 [数组链表解题技巧精讲](https://labuladong.online/algo/ds-class/shu-zu-lia-39fd9/qiang-hua--0b827/)。 -
diff --git a/算法思维系列/常用的位操作.md b/算法思维系列/常用的位操作.md index 949f201..33df1fe 100644 --- a/算法思维系列/常用的位操作.md +++ b/算法思维系列/常用的位操作.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/洗牌算法.md b/算法思维系列/洗牌算法.md index 17fd820..68a875c 100644 --- a/算法思维系列/洗牌算法.md +++ b/算法思维系列/洗牌算法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/滑动窗口技巧进阶.md b/算法思维系列/滑动窗口技巧进阶.md index 9ef5d2a..7805684 100644 --- a/算法思维系列/滑动窗口技巧进阶.md +++ b/算法思维系列/滑动窗口技巧进阶.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -39,9 +39,23 @@ 哈哈,我自己快把自己夸上天了,大家乐一乐就好,不要当真:) -关于双指针的快慢指针和左右指针的用法,可以参见前文 [双指针技巧汇总](https://labuladong.github.io/article/fname.html?fname=双指针技巧),本文就解决一类最难掌握的双指针技巧:滑动窗口技巧。总结出一套框架,可以保你闭着眼睛都能写出正确的解法。 +关于双指针的快慢指针和左右指针的用法,可以参见前文 [双指针技巧汇总](https://labuladong.github.io/article/fname.html?fname=双指针技巧),本文就解决一类最难掌握的双指针技巧:滑动窗口技巧。并总结出一套框架,可以保你闭着眼睛都能写出正确的解法。 -说起滑动窗口算法,很多读者都会头疼。这个算法技巧的思路非常简单,就是维护一个窗口,不断滑动,然后更新答案么。LeetCode 上有起码 10 道运用滑动窗口算法的题目,难度都是中等和困难。该算法的大致逻辑如下: +### 滑动窗口框架概览 + +**滑动窗口算法技巧主要用来解决子数组问题,比如让你寻找符合某个条件的最长/最短子数组**。 + +如果用暴力解的话,你需要嵌套 for 循环这样穷举所有子数组,时间复杂度是 `O(N^2)`: + +```cpp +for (int i = 0; i < nums.size(); i++) { + for (int j = i; j < nums.size(); j++) { + // nums[i, j] 是一个子数组 + } +} +``` + +滑动窗口算法技巧的思路也不难,就是维护一个窗口,不断滑动,然后更新答案,该算法的大致逻辑如下: ```cpp int left = 0, right = 0; @@ -59,17 +73,33 @@ while (left < right && right < nums.size()) { } ``` -这个算法技巧的时间复杂度是 O(N),比字符串暴力算法要高效得多。 +基于滑动窗口算法框架写出的代码,时间复杂度是 `O(N)`,比嵌套 for 循环的暴力解法效率高。 -其实困扰大家的,不是算法的思路,而是各种细节问题。比如说如何向窗口中添加新元素,如何缩小窗口,在窗口滑动的哪个阶段更新结果。即便你明白了这些细节,也容易出 bug,找 bug 还不知道怎么找,真的挺让人心烦的。 +::: info 为啥是 `O(N)`? -**所以今天我就写一套滑动窗口算法的代码框架,我连再哪里做输出 debug 都给你写好了,以后遇到相关的问题,你就默写出来如下框架然后改三个地方就行,还不会出 bug**: +肯定有读者要问了,你这个滑动窗口框架不也用了一个嵌套 while 循环?为啥复杂度是 `O(N)` 呢? + +简单说,指针 `left, right` 不会回退(它们的值只增不减),所以字符串/数组中的每个元素都只会进入窗口一次,然后被移出窗口一次,不会说有某些元素多次进入和离开窗口,所以算法的时间复杂度就和字符串/数组的长度成正比。 + +反观嵌套 for 循环的暴力解法,那个 `j` 会回退,所以某些元素会进入和离开窗口多次,所以时间复杂度就是 `O(N^2)` 了。 + +我在 [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) 有教大家如何从理论上估算时间空间复杂度,这里就不展开了。 + +::: + +其实困扰大家的,不是算法的思路,而是各种细节问题。比如说如何向窗口中添加新元素,如何缩小窗口,在窗口滑动的哪个阶段更新结果。即便你明白了这些细节,代码也容易出 bug,找 bug 还不知道怎么找,真的挺让人心烦的。 + +**所以今天我就写一套滑动窗口算法的代码框架,我连再哪里做输出 debug 都给你写好了,以后遇到相关的问题,你就默写出来如下框架然后改三个地方就行,保证不会出 bug**。 + +因为本文的例题大多是子串相关的题目,字符串实际上就是数组,所以我就把输入设置成字符串了。你做题的时候根据具体题目自行变通即可: ```cpp /* 滑动窗口算法框架 */ void slidingWindow(string s) { - // 用合适的数据结构记录窗口中的数据 + // 用合适的数据结构记录窗口中的数据,根据具体场景变通 + // 比如说,我想记录窗口中元素出现的次数,就用 map + // 我想记录窗口中的元素和,就用 int unordered_map window; int left = 0, right = 0; @@ -102,23 +132,13 @@ void slidingWindow(string s) { } ``` -因为下面讲解的题目大都是字符串相关的,所以上面这个框架就以字符串为例了。但实际上字符串就是数组,所以这个框架完全可以套用在数组类型的题目上,你根据具体题目自行变通即可。 +**框架中两处 `...` 表示的更新窗口数据的地方,在具体的题目中,你需要做的就是往这里面填代码逻辑**。而且,这两个 `...` 处的操作分别是扩大和缩小窗口的更新操作,等会你会发现它们操作是完全对称的。 -**框架中两处 `...` 表示的更新窗口数据的地方,在具体的题目中,你需要做的就是往这里面填代码逻辑**。 +说句题外话,有些读者评论我这个框架,说散列表速度慢,不如用数组代替散列表;还有些人喜欢把代码写得特别短小,说我这样代码太多余,速度不够快。我的意见是,算法主要看时间复杂度,你能确保自己的时间复杂度最优就行了。至于 LeetCode 的运行速度,那个有点玄学,只要不是慢的离谱就没啥问题,根本不值得你从编译层面优化,不要舍本逐末…… -而且,这两个 `...` 处的操作分别是扩大和缩小窗口的更新操作,等会你会发现它们操作是完全对称的。 +再说,我的算法教程重点在于算法思想,你先做到能把框架思维运用自如,然后随便你魔改代码好吧,保你怎么写都能写对。 -另外,虽然滑动窗口代码框架中有一个嵌套的 while 循环,但算法的时间复杂度依然是 `O(N)`,其中 `N` 是输入字符串/数组的长度。 - -为什么呢?简单说,指针 `left, right` 不会回退(它们的值只增不减),所以字符串/数组中的每个元素都只会进入窗口一次,然后被移出窗口一次,不会说有某些元素多次进入和离开窗口,所以算法的时间复杂度就和字符串/数组的长度成正比。前文 [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) 有具体讲时间复杂度的估算,这里就不展开了。 - -说句题外话,我发现很多人喜欢执着于表象,不喜欢探求问题的本质。比如说有很多人评论我这个框架,说什么散列表速度慢,不如用数组代替散列表;还有很多人喜欢把代码写得特别短小,说我这样代码太多余,影响编译速度,LeetCode 上速度不够快。 - -我的意见是,算法主要看时间复杂度,你能确保自己的时间复杂度最优就行了。至于 LeetCode 所谓的运行速度,那个都是玄学,只要不是慢的离谱就没啥问题,根本不值得你从编译层面优化,不要舍本逐末…… - -我的公众号重点在于算法思想,你把框架思维了然于心,然后随你魔改代码好吧,你高兴就好。 - -言归正传,下面就直接上**四道**力扣原题来套这个框架,其中第一道题会详细说明其原理,后面四道就直接闭眼睛秒杀了。 +言归正传,下面就直接上四道力扣原题来套这个框架,其中第一道题会详细说明其原理,后面四道就直接闭眼睛秒杀了。 因为滑动窗口很多时候都是在处理字符串相关的问题,而 Java 处理字符串不方便,所以本文代码为 C++ 实现。不会用到什么特定的编程语言技巧,但是还是简单介绍一下一些用到的数据结构,以免有的读者因为语言的细节问题阻碍对算法思想的理解: @@ -151,9 +171,13 @@ for (int i = 0; i < s.size(); i++) 1、我们在字符串 `S` 中使用双指针中的左右指针技巧,初始化 `left = right = 0`,把索引**左闭右开**区间 `[left, right)` 称为一个「窗口」。 -::: tip +::: tip 为什么要「左闭右开」区间 -理论上你可以设计两端都开或者两端都闭的区间,但设计为左闭右开区间是最方便处理的。因为这样初始化 `left = right = 0` 时区间 `[0, 0)` 中没有元素,但只要让 `right` 向右移动(扩大)一位,区间 `[0, 1)` 就包含一个元素 `0` 了。如果你设置为两端都开的区间,那么让 `right` 向右移动一位后开区间 `(0, 1)` 仍然没有元素;如果你设置为两端都闭的区间,那么初始区间 `[0, 0]` 就包含了一个元素。这两种情况都会给边界处理带来不必要的麻烦。 +理论上你可以设计两端都开或者两端都闭的区间,但设计为左闭右开区间是最方便处理的。 + +因为这样初始化 `left = right = 0` 时区间 `[0, 0)` 中没有元素,但只要让 `right` 向右移动(扩大)一位,区间 `[0, 1)` 就包含一个元素 `0` 了。 + +如果你设置为两端都开的区间,那么让 `right` 向右移动一位后开区间 `(0, 1)` 仍然没有元素;如果你设置为两端都闭的区间,那么初始区间 `[0, 0]` 就包含了一个元素。这两种情况都会给边界处理带来不必要的麻烦。 ::: @@ -163,7 +187,7 @@ for (int i = 0; i < s.size(); i++) 4、重复第 2 和第 3 步,直到 `right` 到达字符串 `S` 的尽头。 -这个思路其实也不难,**第 2 步相当于在寻找一个「可行解」,然后第 3 步在优化这个「可行解」,最终找到最优解**,也就是最短的覆盖子串。左右指针轮流前进,窗口大小增增减减,窗口不断向右滑动,这就是「滑动窗口」这个名字的来历。 +这个思路其实也不难,**第 2 步相当于在寻找一个「可行解」,然后第 3 步在优化这个「可行解」,最终找到最优解**,也就是最短的覆盖子串。左右指针轮流前进,窗口大小增增减减,就好像一条毛毛虫,一伸一缩,不断向右滑动,这就是「滑动窗口」这个名字的来历。 下面画图理解一下,`needs` 和 `window` 相当于计数器,分别记录 `T` 中字符出现次数和「窗口」中的相应字符的出现次数。 @@ -461,7 +485,9 @@ int lengthOfLongestSubstring(string s) {
引用本文的文章 + - [【强化练习】单调队列的通用实现及经典习题](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=最大子数组) @@ -469,7 +495,6 @@ int lengthOfLongestSubstring(string s) { - [双指针技巧秒杀七道数组题目](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=ds课程简介) - [本站简介](https://labuladong.github.io/article/fname.html?fname=home) - [滑动窗口算法延伸:Rabin Karp 字符匹配算法](https://labuladong.github.io/article/fname.html?fname=rabinkarp) - [算法时空复杂度分析实用指南](https://labuladong.github.io/article/fname.html?fname=时间复杂度) diff --git a/算法思维系列/烧饼排序.md b/算法思维系列/烧饼排序.md index ddb6d6d..fe9f974 100644 --- a/算法思维系列/烧饼排序.md +++ b/算法思维系列/烧饼排序.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/算法思维系列/花式遍历.md b/算法思维系列/花式遍历.md index d027bc4..9afbacb 100644 --- a/算法思维系列/花式遍历.md +++ b/算法思维系列/花式遍历.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -331,9 +331,6 @@ int[][] generateMatrix(int n) { 以上就是遍历二维数组的一些技巧,其他数组技巧可参见之前的文章 [前缀和数组](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=链表技巧)。 -> info:最后打个广告,我亲自制作了一门 [数据结构精品课](https://labuladong.online/algo/ds-class/),以视频课为主,手把手带你实现常用的数据结构及相关算法,旨在帮助算法基础较为薄弱的读者深入理解常用数据结构的底层原理,在算法学习中少走弯路。 - - diff --git a/算法思维系列/集合划分.md b/算法思维系列/集合划分.md index acf5891..8f1c788 100644 --- a/算法思维系列/集合划分.md +++ b/算法思维系列/集合划分.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -180,7 +180,7 @@ class Solution { 我直接用 [算法可视化面板](https://labuladong.github.io/article/fname.html?fname=可视化简介) 把递归树画出来,你一眼就可以看懂了。请你把进度条拖到最后让整棵回溯树显示出来,然后把鼠标在每一层节点上横向移动,观察递归树节点和树枝上的值: - + ::: tip 拓展延伸 @@ -197,11 +197,11 @@ class Solution { 我只需要稍改之前的全排列代码,并修改一下可视化注释,就让你立刻看明白。请你把鼠标移动到每个节点上,在每一层横向移动,查看每一层的节点的值以及树枝上显示的选择: - + 当然,上述代码还有优化空间,比如说你发现那个 `used` 数组不是必要的,我们可以只通过那个 `count` 参数,保证 `[0..count]` 的球都是已经放进盒子的,`[count..]`后面的球是需要穷举位置的。这样就可以进一步优化空间复杂度: - + 好了,这就是有些读者心心念念的,通过 `swap` 方式的全排列代码,这有什么难吗? @@ -255,7 +255,7 @@ class Solution { 那么,以桶的视角理解,子集问题相当于把 `n` 个球丢到容量为 `n` 的桶里,桶可以不装满。 -这样,第一个球面对的是空桶,所以可以有 `n` 种位置选择,第二个球面对的是已经装了一个球的桶,所以可以有 `n - 1` 种位置选择,第三个球有 `n - 2` 种位置选择,以此类推。 +这样,桶的第一个位置可以选择 `n` 个球中的任意一个,然后桶的第二个位置可以选择 `n - 1` 个球中的任意一个,以此类推。 你看代码也能体现出来这种穷举过程,`start` 来控制选择空间逐渐缩小: @@ -273,9 +273,9 @@ void backtrack(int[] nums, int start) { ::: -我继续用 [算法可视化面板](https://labuladong.github.io/article/fname.html?fname=可视化简介) 来论证我的答案,请你把进度条拖到最后让整棵回溯树显示出来,然后把鼠标在每一层节点上横向移动,观察递归树节点和树枝上的值,你可以很直观地看明白: +我继续用 [算法可视化面板](https://labuladong.github.io/article/fname.html?fname=可视化简介) 来论证我的答案,请你把进度条拖到最后让整棵回溯树显示出来,然后把鼠标在每一层节点上横向移动,观察递归树节点和树枝上的值,你可以很直观地看明白,是桶的位置在选择球: - + ::: important 最后一次考你 @@ -321,7 +321,7 @@ class Solution { 我继续用 [算法可视化面板](https://labuladong.github.io/article/fname.html?fname=可视化简介) 来论证我的答案,请你把进度条拖到最后让整棵回溯树显示出来,然后把鼠标在节点上移动,观察递归树节点和树枝上的值: - + 这也解释了,为什么所有子集(幂集)的数量是 `2^n`,因为每个元素都有两种选择,要么在子集中,要么不在子集中,所以其递归树就是一棵满二叉树,一共有 `2^n` 个叶子节点。 @@ -347,7 +347,7 @@ class Solution { 你可能问,这两种视角有什么不同? -**用不同的视角进行穷举,虽然结果相同,但是解法代码的逻辑完全不同,进而算法的效率也会不同;对比不同的穷举视角,可以帮你更深刻地理解回溯算法,我们慢慢道来**。 +和前面讲的排列子集类似,用不同的视角进行穷举,虽然结果相同,但是解法代码的逻辑不同,具体的代码实现也不同,可能产生不同的时间、空间复杂度。我们需要选择复杂度更低的解法。 ### 以数字的视角 diff --git a/高频面试系列/LRU算法.md b/高频面试系列/LRU算法.md index 4c1075b..976eb1d 100644 --- a/高频面试系列/LRU算法.md +++ b/高频面试系列/LRU算法.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -369,7 +369,7 @@ class LRUCache {
引用本文的文章 - - [一文看懂 session 和 cookie](https://labuladong.github.io/article/fname.html?fname=session和cookie) + - [一文读懂 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) diff --git a/高频面试系列/k个一组反转链表.md b/高频面试系列/k个一组反转链表.md index d733c06..d4e9919 100644 --- a/高频面试系列/k个一组反转链表.md +++ b/高频面试系列/k个一组反转链表.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/一行代码解决的智力题.md b/高频面试系列/一行代码解决的智力题.md index 2e3b263..cb8df6c 100644 --- a/高频面试系列/一行代码解决的智力题.md +++ b/高频面试系列/一行代码解决的智力题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/二分查找判定子序列.md b/高频面试系列/二分查找判定子序列.md index dceded1..0717b38 100644 --- a/高频面试系列/二分查找判定子序列.md +++ b/高频面试系列/二分查找判定子序列.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/二分运用.md b/高频面试系列/二分运用.md index 52bec56..4ff1dfb 100644 --- a/高频面试系列/二分运用.md +++ b/高频面试系列/二分运用.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/判断回文链表.md b/高频面试系列/判断回文链表.md index 7215cea..0930919 100644 --- a/高频面试系列/判断回文链表.md +++ b/高频面试系列/判断回文链表.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -271,9 +271,6 @@ p.next = reverse(q); 具体到回文链表的判断问题,由于回文的特殊性,可以不完全反转链表,而是仅仅反转部分链表,将空间复杂度降到 O(1)。 -> info:最后打个广告,我亲自制作了一门 [数据结构精品课](https://labuladong.online/algo/ds-class/),以视频课为主,手把手带你实现常用的数据结构及相关算法,旨在帮助算法基础较为薄弱的读者深入理解常用数据结构的底层原理,在算法学习中少走弯路。 - - diff --git a/高频面试系列/名人问题.md b/高频面试系列/名人问题.md index 77ff1f0..7a4e2e7 100644 --- a/高频面试系列/名人问题.md +++ b/高频面试系列/名人问题.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/子集排列组合.md b/高频面试系列/子集排列组合.md index 0a5e212..e96ac51 100644 --- a/高频面试系列/子集排列组合.md +++ b/高频面试系列/子集排列组合.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -1003,6 +1003,7 @@ 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=时间复杂度) diff --git a/高频面试系列/安排会议室.md b/高频面试系列/安排会议室.md index fece4d8..2230354 100644 --- a/高频面试系列/安排会议室.md +++ b/高频面试系列/安排会议室.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** @@ -43,7 +43,15 @@ int minMeetingRooms(int[][] meetings); 换句话说,**如果把每个会议的起始时间看做一个线段区间,那么题目就是让你求最多有几个重叠区间**,仅此而已。 -对于这种时间安排的问题,本质上讲就是区间调度问题,十有八九得排序,然后找规律来解决。 +我们之前也学习过区间相关的算法,如果你对 [差分数组技巧](https://labuladong.github.io/article/fname.html?fname=差分技巧) 有印象,应该首先能想到用那个技巧来解决这个题。 + +这道题相当于是说,给你一个原本全是 0 的数组,然后给你若干区间,让你对每个区间中的元素都加 1,问你最后整个数组中的最大值是多少。这就是经典的差分数组实用场景对吧,直接套用前文给的 `Difference` 类就可以解决这个问题了。 + +但是差分数组技巧有一个问题,就是你必须把那个全是 0 的初始数组构造出来。由于我们用数组的索引表示时间,所以这个数组的长度取决于时间区间的最大值。 + +比如输入 `meetings = [[0,30],[5,10],[15,20]]`,那么你得构造一个长度为 30 的数组。那如果输入 `meetings = [[0,30],[5,10],[10^8,10^9]]`,这样的话你就得构造一个长度为 10^9 的数组,这显然是有问题的。不过这道题给的数据规模是时间的取值最多为 10^6,不算是特别大,用差分数组的方法应该可以通过。 + +但本文再教你另外的一个处理区间的技巧,不用构造这么大的数组,也能巧妙解决这个问题。 ### 题目延伸 @@ -75,15 +83,31 @@ int minMeetingRooms(int[][] meetings); 会议室可以看做一个背包,每个会议可以看做一个物品,物品的价值就是会议的时长,请问你如何选择物品(会议)才能最大化背包中的价值(会议室的使用时长)? -当然,这里背包的约束不是一个最大重量,而是各个物品(会议)不能互相冲突。把各个会议按照结束时间进行排序,然后参考前文 [0-1 背包问题详解](https://labuladong.github.io/article/fname.html?fname=背包问题) 的思路即可解决,等我以后有机会可以写一写这个问题。 +当然,这里背包的约束不是一个最大重量,而是各个物品(会议)不能互相冲突。把各个会议按照结束时间进行排序,然后参考前文 [0-1 背包问题详解](https://labuladong.github.io/article/fname.html?fname=背包问题) 的思路和 TreeMap 即可解决。 -**第七个场景**,就是本文想讲的场景,给你若干会议,让你合理申请会议室。 +力扣第 1235 题「规划兼职工作」就是类似的题目,我在插件思路中给出了详细的解答,你可以安装我的 [Chrome 插件](https://labuladong.github.io/article/fname.html?fname=chrome插件简介) 去查看,我在这里就不花费篇幅了。 + +**第七个场景**,就是本文想讲的场景,给你若干会议,让你最小化申请会议室的数量。 好了,举例了这么多,来看看今天的这个问题如何解决。 +
+
+引用本文的题目 + +安装 [我的 Chrome 刷题插件](https://labuladong.github.io/article/fname.html?fname=chrome插件简介) 点开下列题目可直接查看解题思路: + +| LeetCode | 力扣 | +| :----: | :----: | +| [1235. Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling/?show=1) | [1235. 规划兼职工作](https://leetcode.cn/problems/maximum-profit-in-job-scheduling/?show=1) | + +
+
+ + **_____________** diff --git a/高频面试系列/岛屿题目.md b/高频面试系列/岛屿题目.md index 3304fd1..57321e7 100644 --- a/高频面试系列/岛屿题目.md +++ b/高频面试系列/岛屿题目.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/座位调度.md b/高频面试系列/座位调度.md index 86c9caf..b0d86eb 100644 --- a/高频面试系列/座位调度.md +++ b/高频面试系列/座位调度.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/打印素数.md b/高频面试系列/打印素数.md index 9c7a99c..b921f1c 100644 --- a/高频面试系列/打印素数.md +++ b/高频面试系列/打印素数.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/接雨水.md b/高频面试系列/接雨水.md index 053e842..45dbb11 100644 --- a/高频面试系列/接雨水.md +++ b/高频面试系列/接雨水.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/缺失和重复的元素.md b/高频面试系列/缺失和重复的元素.md index 1a70a70..e3ad4b3 100644 --- a/高频面试系列/缺失和重复的元素.md +++ b/高频面试系列/缺失和重复的元素.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** diff --git a/高频面试系列/随机权重.md b/高频面试系列/随机权重.md index 37cc179..c38efca 100644 --- a/高频面试系列/随机权重.md +++ b/高频面试系列/随机权重.md @@ -9,7 +9,7 @@ ![](https://labuladong.github.io/pictures/souyisou1.png) -**通知:[数据结构精品课](https://labuladong.online/algo/ds-class/) 和 [递归算法专题课](https://labuladong.online/algo/tree-class/) 限时附赠网站会员;算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。** +**通知:算法可视化编辑器上线,[点击体验](https://labuladong.online/algo-visualize/)!另外,建议你在我的 [网站](https://labuladong.online/algo/) 学习文章,体验更好。**