Skip to content

Commit 6111d6f

Browse files
committed
fix:site_url
1 parent e94b84c commit 6111d6f

70 files changed

Lines changed: 242 additions & 242 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ English version repo and Gitbook is on [english branch](https://github.com/labul
33
# labuladong 的算法小抄
44

55
<p align='center'>
6-
<a href="https://labuladong.gitee.io/algo" target="_blank"><img alt="Website" src="https://img.shields.io/website?label=%E5%9C%A8%E7%BA%BF%E7%94%B5%E5%AD%90%E4%B9%A6&style=flat-square&down_color=blue&down_message=%E7%82%B9%E8%BF%99%E9%87%8C&up_color=blue&up_message=%E7%82%B9%E8%BF%99%E9%87%8C&url=https%3A%2F%2Flabuladong.gitee.io%2Falgo&logo=Gitea"></a>
6+
<a href="https://labuladong.github.io/algo" target="_blank"><img alt="Website" src="https://img.shields.io/website?label=%E5%9C%A8%E7%BA%BF%E7%94%B5%E5%AD%90%E4%B9%A6&style=flat-square&down_color=blue&down_message=%E7%82%B9%E8%BF%99%E9%87%8C&up_color=blue&up_message=%E7%82%B9%E8%BF%99%E9%87%8C&url=https%3A%2F%2Flabuladong.gitee.io%2Falgo&logo=Gitea"></a>
77
<a href="https://github.com/labuladong/fucking-algorithm" target="_blank"><img alt="GitHub" src="https://img.shields.io/github/stars/labuladong/fucking-algorithm?label=Stars&style=flat-square&logo=GitHub"></a>
88
</p>
99

@@ -51,7 +51,7 @@ Gitbook 地址:https://labuladong.gitbook.io/algo/
5151

5252
GitBook 在国内访问速度很慢,且常被攻击,我特意部署了两个镜像站点,大家可根据网络情况自行选择:
5353

54-
Gitee Pages 地址:https://labuladong.gitee.io/algo/ (推荐)
54+
Gitee Pages 地址:https://labuladong.github.io/algo/ (推荐)
5555

5656
GitHub Pages 地址:https://labuladong.github.io/algo/
5757

动态规划系列/动态规划之KMP字符匹配算法.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
![](../pictures/souyisou.png)
1212

1313
相关推荐:
14-
* [经典动态规划:最长公共子序列](https://labuladong.gitee.io/algo/)
15-
* [特殊数据结构:单调栈](https://labuladong.gitee.io/algo/)
14+
* [经典动态规划:最长公共子序列](https://labuladong.github.io/algo/)
15+
* [特殊数据结构:单调栈](https://labuladong.github.io/algo/)
1616

1717
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1818

@@ -423,7 +423,7 @@ KMP 算法也就是动态规划那点事,我们的公众号文章目录有一
423423

424424
**_____________**
425425

426-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
426+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
427427

428428
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
429429

动态规划系列/动态规划之博弈问题.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
![](../pictures/souyisou.png)
1212

1313
相关推荐:
14-
* [40张图解:TCP三次握手和四次挥手面试题](https://labuladong.gitee.io/algo/)
15-
* [如何计算完全二叉树的节点数](https://labuladong.gitee.io/algo/)
14+
* [40张图解:TCP三次握手和四次挥手面试题](https://labuladong.github.io/algo/)
15+
* [如何计算完全二叉树的节点数](https://labuladong.github.io/algo/)
1616

1717
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1818

1919
[877.石子游戏](https://leetcode-cn.com/problems/stone-game)
2020

2121
**-----------**
2222

23-
上一篇文章 [几道智力题](https://labuladong.gitee.io/algo/) 中讨论到一个有趣的「石头游戏」,通过题目的限制条件,这个游戏是先手必胜的。但是智力题终究是智力题,真正的算法问题肯定不会是投机取巧能搞定的。所以,本文就借石头游戏来讲讲「假设两个人都足够聪明,最后谁会获胜」这一类问题该如何用动态规划算法解决。
23+
上一篇文章 [几道智力题](https://labuladong.github.io/algo/) 中讨论到一个有趣的「石头游戏」,通过题目的限制条件,这个游戏是先手必胜的。但是智力题终究是智力题,真正的算法问题肯定不会是投机取巧能搞定的。所以,本文就借石头游戏来讲讲「假设两个人都足够聪明,最后谁会获胜」这一类问题该如何用动态规划算法解决。
2424

2525
博弈类问题的套路都差不多,下文参考 [这个 YouTube 视频](https://www.youtube.com/watch?v=WxpIHvsu1RI) 的思路讲解,其核心思路是在二维 dp 的基础上使用元组分别存储两个人的博弈结果。掌握了这个技巧以后,别人再问你什么俩海盗分宝石,俩人拿硬币的问题,你就告诉别人:我懒得想,直接给你写个算法算一下得了。
2626

@@ -207,7 +207,7 @@ int stoneGame(int[] piles) {
207207

208208
**_____________**
209209

210-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
210+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
211211

212212
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
213213

动态规划系列/动态规划之四键键盘.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
![](../pictures/souyisou.png)
1212

1313
相关推荐:
14-
* [如何高效寻找素数](https://labuladong.gitee.io/algo/)
15-
* [动态规划解题套路框架](https://labuladong.gitee.io/algo/)
14+
* [如何高效寻找素数](https://labuladong.github.io/algo/)
15+
* [动态规划解题套路框架](https://labuladong.github.io/algo/)
1616

1717
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1818

@@ -192,7 +192,7 @@ def dp(n, a_num, copy):
192192

193193
**_____________**
194194

195-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
195+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
196196

197197
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
198198

动态规划系列/动态规划之正则表达.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
![](../pictures/souyisou.png)
1111

1212
相关推荐:
13-
* [我写了首诗,把滑动窗口算法算法变成了默写题](https://labuladong.gitee.io/algo/)
14-
* [二分查找高效判定子序列](https://labuladong.gitee.io/algo/)
13+
* [我写了首诗,把滑动窗口算法算法变成了默写题](https://labuladong.github.io/algo/)
14+
* [二分查找高效判定子序列](https://labuladong.github.io/algo/)
1515

1616
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1717

@@ -287,7 +287,7 @@ bool dp(string& s, int i, string& p, int j) {
287287

288288
**_____________**
289289

290-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
290+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
291291

292292
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
293293

动态规划系列/动态规划设计:最长递增子序列.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
![](../pictures/souyisou.png)
1111

1212
相关推荐:
13-
* [动态规划设计:最大子数组](https://labuladong.gitee.io/algo/)
14-
* [一文学会递归解题](https://labuladong.gitee.io/algo/)
13+
* [动态规划设计:最大子数组](https://labuladong.github.io/algo/)
14+
* [一文学会递归解题](https://labuladong.github.io/algo/)
1515

1616
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1717

1818
[300.最长上升子序列](https://leetcode-cn.com/problems/longest-increasing-subsequence)
1919

2020
**-----------**
2121

22-
也许有读者看了前文 [动态规划详解](https://labuladong.gitee.io/algo/),学会了动态规划的套路:找到了问题的「状态」,明确了 `dp` 数组/函数的含义,定义了 base case;但是不知道如何确定「选择」,也就是不到状态转移的关系,依然写不出动态规划解法,怎么办?
22+
也许有读者看了前文 [动态规划详解](https://labuladong.github.io/algo/),学会了动态规划的套路:找到了问题的「状态」,明确了 `dp` 数组/函数的含义,定义了 base case;但是不知道如何确定「选择」,也就是不到状态转移的关系,依然写不出动态规划解法,怎么办?
2323

2424
不要担心,动态规划的难点本来就在于寻找正确的状态转移方程,本文就借助经典的「最长递增子序列问题」来讲一讲设计动态规划的通用技巧:**数学归纳思想**
2525

@@ -43,7 +43,7 @@
4343

4444
**我们的定义是这样的:`dp[i]` 表示以 `nums[i]` 这个数结尾的最长递增子序列的长度。**
4545

46-
PS:为什么这样定义呢?这是解决子序列问题的一个套路,后文[动态规划之子序列问题解题模板](https://labuladong.gitee.io/algo/) 总结了几种常见套路。你读完本章所有的动态规划问题,就会发现 `dp` 数组的定义方法也就那几种。
46+
PS:为什么这样定义呢?这是解决子序列问题的一个套路,后文[动态规划之子序列问题解题模板](https://labuladong.github.io/algo/) 总结了几种常见套路。你读完本章所有的动态规划问题,就会发现 `dp` 数组的定义方法也就那几种。
4747

4848
根据这个定义,我们就可以推出 base case:`dp[i]` 初始值为 1,因为以 `nums[i]` 结尾的最长递增子序列起码要包含它自己。
4949

@@ -164,7 +164,7 @@ public int lengthOfLIS(int[] nums) {
164164

165165
我们只要把处理扑克牌的过程编程写出来即可。每次处理一张扑克牌不是要找一个合适的牌堆顶来放吗,牌堆顶的牌不是**有序**吗,这就能用到二分查找了:用二分查找来搜索当前牌应放置的位置。
166166

167-
PS:旧文[二分查找算法详解](https://labuladong.gitee.io/algo/)详细介绍了二分查找的细节及变体,这里就完美应用上了,如果没读过强烈建议阅读。
167+
PS:旧文[二分查找算法详解](https://labuladong.github.io/algo/)详细介绍了二分查找的细节及变体,这里就完美应用上了,如果没读过强烈建议阅读。
168168

169169
```java
170170
public int lengthOfLIS(int[] nums) {
@@ -207,7 +207,7 @@ public int lengthOfLIS(int[] nums) {
207207

208208
**_____________**
209209

210-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
210+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
211211

212212
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
213213

动态规划系列/动态规划详解进阶.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
![](../pictures/souyisou.png)
1212

1313
相关推荐:
14-
* [经典动态规划:完全背包问题](https://labuladong.gitee.io/algo/)
15-
* [Git/SQL/正则表达式的在线练习平台](https://labuladong.gitee.io/algo/)
14+
* [经典动态规划:完全背包问题](https://labuladong.github.io/algo/)
15+
* [Git/SQL/正则表达式的在线练习平台](https://labuladong.github.io/algo/)
1616

1717
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1818

@@ -218,7 +218,7 @@ int coinChange(int[] coins, int amount);
218218

219219
回到凑零钱问题,为什么说它符合最优子结构呢?比如你想求 `amount = 11` 时的最少硬币数(原问题),如果你知道凑出 `amount = 10` 的最少硬币数(子问题),你只需要把子问题的答案加一(再选一枚面值为 1 的硬币)就是原问题的答案。因为硬币的数量是没有限制的,所以子问题之间没有相互制,是互相独立的。
220220

221-
PS:关于最优子结构的问题,后文[动态规划答疑篇](https://labuladong.gitee.io/algo/) 还会再举例探讨。
221+
PS:关于最优子结构的问题,后文[动态规划答疑篇](https://labuladong.github.io/algo/) 还会再举例探讨。
222222

223223
那么,既然知道了这是个动态规划问题,就要思考**如何列出正确的状态转移方程**
224224

@@ -362,7 +362,7 @@ PS:为啥 `dp` 数组初始化为 `amount + 1` 呢,因为凑成 `amount` 金
362362

363363
**_____________**
364364

365-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
365+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
366366

367367
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
368368

动态规划系列/团灭股票问题.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
![](../pictures/souyisou.png)
1212

1313
相关推荐:
14-
* [动态规划之KMP字符匹配算法](https://labuladong.gitee.io/algo/)
15-
* [如何判断回文链表](https://labuladong.gitee.io/algo/)
14+
* [动态规划之KMP字符匹配算法](https://labuladong.github.io/algo/)
15+
* [如何判断回文链表](https://labuladong.github.io/algo/)
1616

1717
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1818

@@ -420,7 +420,7 @@ int maxProfit_k_any(int max_k, int[] prices) {
420420

421421
**_____________**
422422

423-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
423+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
424424

425425
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
426426

动态规划系列/子序列问题模板.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
![](../pictures/souyisou.png)
1313

1414
相关推荐:
15-
* [洗牌算法](https://labuladong.gitee.io/algo/)
16-
* [twoSum问题的核心思想](https://labuladong.gitee.io/algo/)
15+
* [洗牌算法](https://labuladong.github.io/algo/)
16+
* [twoSum问题的核心思想](https://labuladong.github.io/algo/)
1717

1818
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1919

@@ -166,7 +166,7 @@ int longestPalindromeSubseq(string s) {
166166
167167
**_____________**
168168
169-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**。
169+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**。
170170
171171
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,labuladong 带你搞定 LeetCode**。
172172

动态规划系列/抢房子.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
![](../pictures/souyisou.png)
1111

1212
相关推荐:
13-
* [动态规划之四键键盘](https://labuladong.gitee.io/algo/)
14-
* [经典动态规划:子集背包问题](/https://labuladong.gitee.io/algo/)
13+
* [动态规划之四键键盘](https://labuladong.github.io/algo/)
14+
* [经典动态规划:子集背包问题](/https://labuladong.github.io/algo/)
1515

1616
读完本文,你不仅学会了算法套路,还可以顺便去 LeetCode 上拿下如下题目:
1717

@@ -250,7 +250,7 @@ int[] dp(TreeNode root) {
250250

251251
**_____________**
252252

253-
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.gitee.io/algo/) 持续更新最新文章**
253+
**刷算法,学套路,认准 labuladong,公众号和 [在线电子书](https://labuladong.github.io/algo/) 持续更新最新文章**
254254

255255
**本小抄即将出版,微信扫码关注公众号,后台回复「小抄」限时免费获取,回复「进群」可进刷题群一起刷题,带你搞定 LeetCode**
256256

0 commit comments

Comments
 (0)