From 7f5ce0ac41f35e97d02ecfdf85c940f91c32d026 Mon Sep 17 00:00:00 2001 From: lewiseng <65698183+lewiseng@users.noreply.github.com> Date: Sat, 25 Jan 2025 15:56:17 -0500 Subject: [PATCH 01/10] =?UTF-8?q?Update=200216.=E7=BB=84=E5=90=88=E6=80=BB?= =?UTF-8?q?=E5=92=8CIII.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" index 3d7f2d0c03..04805c93f5 100644 --- "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" +++ "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" @@ -367,7 +367,7 @@ class Solution: def backtracking(self, targetSum, k, currentSum, startIndex, path, result): if currentSum > targetSum: # 剪枝操作 - return # 如果path的长度等于k但currentSum不等于targetSum,则直接返回 + return # 如果currentSum已经超过targetSum,则直接返回 if len(path) == k: if currentSum == targetSum: result.append(path[:]) From da821733ff03cefe9a2bc150e2f9f1821793e5f8 Mon Sep 17 00:00:00 2001 From: HuangLM03 <2306725926@qq.com> Date: Sun, 16 Feb 2025 14:48:02 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0kamacoder/0058=E5=8C=BA=E9=97=B4=E5=92=8C=E7=9A=84Go?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...8.\345\214\272\351\227\264\345\222\214.md" | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" index 23e7189a15..6f400ee433 100644 --- "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" +++ "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" @@ -357,3 +357,54 @@ int main(int argc, char *argv[]) ``` +### Go + +```go +package main + +import ( + "fmt" + "bufio" + "strconv" + "os" +) + +func main() { + // bufio中读取数据的接口,因为数据卡的比较严,导致使用fmt.Scan会超时 + scanner := bufio.NewScanner(os.Stdin) + + // 获取数组大小 + scanner.Scan() + n, _ := strconv.Atoi(scanner.Text()) + + // 获取数组元素的同时计算前缀和,一般建议切片开大一点防止各种越界问题 + arr := make([]int, n + 1) + for i := 0; i < n; i++ { + scanner.Scan() + arr[i], _ = strconv.Atoi(scanner.Text()) + if i != 0 { + arr[i] += arr[i - 1] + } + } + + /* + 区间[l, r]的和可以使用区间[0, r]和[0, l - 1]相减得到, + 在代码中即为arr[r]-arr[l-1]。这里需要注意l-1是否越界 + */ + for { + var l, r int + scanner.Scan() + _, err := fmt.Sscanf(scanner.Text(), "%d %d", &l, &r) + if err != nil { + return + } + + if l > 0 { + fmt.Println(arr[r] - arr[l - 1]) + } else { + fmt.Println(arr[r]) + } + } +} +``` + From ca2cffabd0ac5e2c6efab2be56743265fbe521c4 Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Fri, 14 Mar 2025 17:35:33 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b1db51c903..acd07c28d0 100644 --- a/README.md +++ b/README.md @@ -69,13 +69,14 @@ ## 前序 -* [「代码随想录」学习社区](https://programmercarl.com/other/kstar.html) +* [做项目(多个C++、Java、Go、前端、测开项目)](https://programmercarl.com/other/kstar.html) * 编程语言 * [C++面试&C++学习指南知识点整理](https://github.com/youngyangyang04/TechCPP) * [编程语言基础课](https://kamacoder.com/courseshop.php) * [23种设计模式](https://github.com/youngyangyang04/kama-DesignPattern) + * [大厂算法笔试题](https://kamacoder.com/company.php) * 工具 * [一站式vim配置](https://github.com/youngyangyang04/PowerVim) @@ -384,10 +385,10 @@ 8. [图论:孤岛的总面积](./problems/kamacoder/0101.孤岛的总面积.md) 9. [图论:沉没孤岛](./problems/kamacoder/0102.沉没孤岛.md) 10. [图论:水流问题](./problems/kamacoder/0103.水流问题.md) -11. [图论:建造最大岛屿](./problems/kamacoder/0104.建造最大岛屿.md) -12. [图论:字符串接龙](./problems/kamacoder/0110.字符串接龙.md) -13. [图论:有向图的完全可达性](./problems/kamacoder/0105.有向图的完全可达性.md) -14. [图论:岛屿的周长](./problems/kamacoder/0106.岛屿的周长.md) +11. [图论:岛屿的周长](./problems/kamacoder/0106.岛屿的周长.md) +12. [图论:建造最大岛屿](./problems/kamacoder/0104.建造最大岛屿.md) +13. [图论:字符串接龙](./problems/kamacoder/0110.字符串接龙.md) +14. [图论:有向图的完全可达性](./problems/kamacoder/0105.有向图的完全可达性.md) 15. [图论:并查集理论基础](./problems/kamacoder/图论并查集理论基础.md) 16. [图论:寻找存在的路径](./problems/kamacoder/0107.寻找存在的路径.md) 17. [图论:冗余连接](./problems/kamacoder/0108.冗余连接.md) From 0881fb5e81154b1c55cd663d86bf0d89381be935 Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Fri, 14 Mar 2025 18:05:33 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...227\347\254\246\344\270\262\346\216\245\351\276\231.md" | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" index 5f11e4fbfa..f6d97866da 100644 --- "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" +++ "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" @@ -57,7 +57,11 @@ yhn 2 <= N <= 500

+<<<<<<< HEAD +======= + +>>>>>>> d0bd2dc5 (更新图)

@@ -65,7 +69,8 @@ yhn 以示例1为例,从这个图中可以看出 abc 到 def的路线 不止一条,但最短的一条路径上是4个节点。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240529121038.png) +![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250317105155.png) + 本题只需要求出最短路径的长度就可以了,不用找出具体路径。 From f3c481e80b57b77fc338bc0ee7c2d6514f74ef17 Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Fri, 14 Mar 2025 18:05:59 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=A4=B4=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...44\346\225\260\344\271\213\345\222\214.md" | 12 +++------ ...36\346\226\207\345\255\220\344\270\262.md" | 12 +++------ ...11\346\225\260\344\271\213\345\222\214.md" | 12 +++------ ...27\346\257\215\347\273\204\345\220\210.md" | 12 +++------ ...33\346\225\260\344\271\213\345\222\214.md" | 12 +++------ ...4N\344\270\252\350\212\202\347\202\271.md" | 12 +++------ ...10\347\232\204\346\213\254\345\217\267.md" | 12 +++------ ...55\347\232\204\350\212\202\347\202\271.md" | 12 +++------ ...73\351\231\244\345\205\203\347\264\240.md" | 12 +++------ .../0028.\345\256\236\347\216\260strStr.md" | 12 +++------ ...00\344\270\252\346\216\222\345\210\227.md" | 12 +++------ ...00\344\270\252\344\275\215\347\275\256.md" | 12 +++------ ...22\345\205\245\344\275\215\347\275\256.md" | 12 +++------ ...7.\350\247\243\346\225\260\347\213\254.md" | 12 +++------ ...04\345\220\210\346\200\273\345\222\214.md" | 12 +++------ ...\345\220\210\346\200\273\345\222\214II.md" | 12 +++------ ...2.\346\216\245\351\233\250\346\260\264.md" | 12 +++------ ...\350\267\203\346\270\270\346\210\217II.md" | 12 +++------ ...6.\345\205\250\346\216\222\345\210\227.md" | 12 +++------ ...\345\205\250\346\216\222\345\210\227II.md" | 12 +++------ "problems/0051.N\347\232\207\345\220\216.md" | 12 +++------ .../0052.N\347\232\207\345\220\216II.md" | 12 +++------ ...47\345\255\220\345\272\217\345\222\214.md" | 12 +++------ ...01\350\247\204\345\210\222\357\274\211.md" | 12 +++------ ...72\346\227\213\347\237\251\351\230\265.md" | 12 +++------ ...63\350\267\203\346\270\270\346\210\217.md" | 12 +++------ ...10\345\271\266\345\214\272\351\227\264.md" | 12 +++------ ...\346\227\213\347\237\251\351\230\265II.md" | 12 +++------ ...15\345\220\214\350\267\257\345\276\204.md" | 12 +++------ ...\345\220\214\350\267\257\345\276\204II.md" | 12 +++------ ...0.\347\210\254\346\245\274\346\242\257.md" | 12 +++------ ...14\345\214\205\347\211\210\346\234\254.md" | 12 +++------ ...26\350\276\221\350\267\235\347\246\273.md" | 12 +++------ "problems/0077.\347\273\204\345\220\210.md" | 12 +++------ ...04\345\220\210\344\274\230\345\214\226.md" | 12 +++------ "problems/0078.\345\255\220\351\233\206.md" | 12 +++------ ...47\347\232\204\347\237\251\345\275\242.md" | 12 +++------ "problems/0090.\345\255\220\351\233\206II.md" | 12 +++------ ...\345\216\237IP\345\234\260\345\235\200.md" | 12 +++------ ...11\346\220\234\347\264\242\346\240\221.md" | 12 +++------ ...11\346\220\234\347\264\242\346\240\221.md" | 12 +++------ ...70\345\220\214\347\232\204\346\240\221.md" | 12 +++------ ...60\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...02\345\272\217\351\201\215\345\216\206.md" | 12 +++------ ...00\345\244\247\346\267\261\345\272\246.md" | 12 +++------ ...40\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...11\346\220\234\347\264\242\346\240\221.md" | 12 +++------ ...41\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...00\345\260\217\346\267\261\345\272\246.md" | 12 +++------ ...57\345\276\204\346\200\273\345\222\214.md" | 12 +++------ ...04\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...02\347\202\271\346\214\207\351\222\210.md" | 12 +++------ ...00\344\275\263\346\227\266\346\234\272.md" | 12 +++------ ...\344\275\263\346\227\266\346\234\272II.md" | 12 +++------ ...01\350\247\204\345\210\222\357\274\211.md" | 12 +++------ ...344\275\263\346\227\266\346\234\272III.md" | 12 +++------ ...25\350\257\215\346\216\245\351\276\231.md" | 12 +++------ ...60\345\255\227\344\271\213\345\222\214.md" | 12 +++------ ...25\347\232\204\345\214\272\345\237\237.md" | 12 +++------ ...62\345\233\236\346\226\207\344\270\262.md" | 12 +++------ ...\345\233\236\346\226\207\344\270\262II.md" | 12 +++------ ...4.\345\212\240\346\262\271\347\253\231.md" | 12 +++------ ...06\345\217\221\347\263\226\346\236\234.md" | 12 +++------ ...25\350\257\215\346\213\206\345\210\206.md" | 12 +++------ ...57\345\275\242\351\223\276\350\241\250.md" | 12 +++------ ...\345\275\242\351\223\276\350\241\250II.md" | 12 +++------ ...15\346\216\222\351\223\276\350\241\250.md" | 12 +++------ ...76\345\274\217\346\261\202\345\200\274.md" | 12 +++------ ...14\347\232\204\345\215\225\350\257\215.md" | 12 +++------ ...70\344\272\244\351\223\276\350\241\250.md" | 12 +++------ ...\344\275\263\346\227\266\346\234\272IV.md" | 12 +++------ ...13\350\275\254\346\225\260\347\273\204.md" | 12 +++------ ...23\345\256\266\345\212\253\350\210\215.md" | 12 +++------ ...7.\345\271\277\346\220\234\347\211\210.md" | 12 +++------ ...7.\346\267\261\346\220\234\347\211\210.md" | 12 +++------ ...2.\345\277\253\344\271\220\346\225\260.md" | 12 +++------ ...76\350\241\250\345\205\203\347\264\240.md" | 12 +++------ ...04\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...73\350\275\254\351\223\276\350\241\250.md" | 12 +++------ ...7.\350\257\276\347\250\213\350\241\250.md" | 12 +++------ ...04\345\255\220\346\225\260\347\273\204.md" | 12 +++------ ...\350\257\276\347\250\213\350\241\250II.md" | 3 +++ ...\345\256\266\345\212\253\350\210\215II.md" | 12 +++------ ...345\220\210\346\200\273\345\222\214III.md" | 12 +++------ ...02\347\202\271\344\270\252\346\225\260.md" | 12 +++------ ...27\345\256\236\347\216\260\346\240\210.md" | 12 +++------ ...54\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...36\347\216\260\351\230\237\345\210\227.md" | 12 +++------ ...36\346\226\207\351\223\276\350\241\250.md" | 12 +++------ ...54\345\205\261\347\245\226\345\205\210.md" | 12 +++------ ...54\345\205\261\347\245\226\345\205\210.md" | 12 +++------ ...43\346\234\200\345\244\247\345\200\274.md" | 12 +++------ ...15\345\274\202\344\275\215\350\257\215.md" | 12 +++------ ...00\346\234\211\350\267\257\345\276\204.md" | 12 +++------ ...50\345\271\263\346\226\271\346\225\260.md" | 12 +++------ ...3.\347\247\273\345\212\250\351\233\266.md" | 12 +++------ ...07\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...53\345\206\267\345\206\273\346\234\237.md" | 12 +++------ ...66\351\222\261\345\205\221\346\215\242.md" | 12 +++------ ...11\346\216\222\350\241\214\347\250\213.md" | 12 +++------ ...345\256\266\345\212\253\350\210\215III.md" | 12 +++------ ...64\346\225\260\346\213\206\345\210\206.md" | 12 +++------ ...54\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...30\351\242\221\345\205\203\347\264\240.md" | 12 +++------ ...04\347\232\204\344\272\244\351\233\206.md" | 12 +++------ ...06\345\212\250\345\272\217\345\210\227.md" | 12 +++------ ...10\346\200\273\345\222\214\342\205\243.md" | 12 +++------ ...3.\350\265\216\351\207\221\344\277\241.md" | 12 +++------ ...55\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...66\345\255\220\344\271\213\345\222\214.md" | 12 +++------ ...15\345\273\272\351\230\237\345\210\227.md" | 12 +++------ ...11\345\222\214\345\255\220\351\233\206.md" | 12 +++------ ...64\346\265\201\351\227\256\351\242\230.md" | 12 +++------ ...15\345\217\240\345\214\272\351\227\264.md" | 12 +++------ ...55\347\232\204\350\212\202\347\202\271.md" | 12 +++------ ...25\347\210\206\346\260\224\347\220\203.md" | 12 +++------ ...\346\225\260\347\233\270\345\212\240II.md" | 12 +++------ ...06\345\217\221\351\245\274\345\271\262.md" | 12 +++------ ...20\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...77\347\232\204\345\221\250\351\225\277.md" | 12 +++------ ...4.\344\270\200\345\222\214\351\233\266.md" | 12 +++------ ...36\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...4.\347\233\256\346\240\207\345\222\214.md" | 12 +++------ ...4\345\244\247\345\205\203\347\264\240I.md" | 12 +++------ ...55\347\232\204\344\274\227\346\225\260.md" | 12 +++------ ...\345\244\247\345\205\203\347\264\240II.md" | 12 +++------ ...42\351\202\243\345\245\221\346\225\260.md" | 12 +++------ ...13\350\247\222\347\232\204\345\200\274.md" | 12 +++------ ...07\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...\351\222\261\345\205\221\346\215\242II.md" | 12 +++------ ...17\347\273\235\345\257\271\345\267\256.md" | 12 +++------ ...72\347\264\257\345\212\240\346\240\221.md" | 12 +++------ ...\345\255\227\347\254\246\344\270\262II.md" | 12 +++------ ...40\351\231\244\346\223\215\344\275\234.md" | 12 +++------ ...66\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...36\346\226\207\345\255\220\344\270\262.md" | 12 +++------ ...a2\345\217\202\350\256\256\351\231\242.md" | 12 +++------ ...47\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...24\345\233\236\345\216\237\347\202\271.md" | 12 +++------ ...11\346\220\234\347\264\242\346\240\221.md" | 12 +++------ ...27\347\232\204\344\270\252\346\225\260.md" | 12 +++------ ...22\345\242\236\345\272\217\345\210\227.md" | 12 +++------ ...27\344\275\231\350\277\236\346\216\245.md" | 12 +++------ ...\344\275\231\350\277\236\346\216\245II.md" | 12 +++------ ...00\345\244\247\351\235\242\347\247\257.md" | 12 +++------ ...55\347\232\204\346\220\234\347\264\242.md" | 12 +++------ ...22\345\205\245\346\223\215\344\275\234.md" | 12 +++------ ...14\345\210\206\346\237\245\346\211\276.md" | 12 +++------ ...76\350\256\241\351\223\276\350\241\250.md" | 12 +++------ ...53\346\211\213\347\273\255\350\264\271.md" | 12 +++------ ...01\350\247\204\345\210\222\357\274\211.md" | 12 +++------ ...15\345\255\220\346\225\260\347\273\204.md" | 12 +++------ ...55\345\277\203\347\264\242\345\274\225.md" | 12 +++------ ...36\347\232\204\346\225\260\345\255\227.md" | 12 +++------ ...17\346\227\245\346\270\251\345\272\246.md" | 12 +++------ ...66\350\277\237\346\227\266\351\227\264.md" | 3 +++ ...71\347\210\254\346\245\274\346\242\257.md" | 12 +++------ ...27\346\257\215\345\214\272\351\227\264.md" | 12 +++------ ...34\347\232\204\350\210\252\347\217\255.md" | 12 +++------ ...75\347\232\204\350\267\257\345\276\204.md" | 12 +++------ ...47\344\272\272\345\267\245\345\262\233.md" | 12 +++------ ...31\345\222\214\346\210\277\351\227\264.md" | 12 +++------ ...04\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...54\346\260\264\346\211\276\351\233\266.md" | 12 +++------ ...\345\272\217\346\225\260\347\273\204II.md" | 12 +++------ ...77\346\214\211\351\224\256\345\205\245.md" | 12 +++------ ...61\350\204\211\346\225\260\347\273\204.md" | 12 +++------ ...47\344\272\214\345\217\211\346\240\221.md" | 12 +++------ ...04\347\232\204\345\271\263\346\226\271.md" | 12 +++------ ...70\347\224\250\345\255\227\347\254\246.md" | 12 +++------ ...04\346\225\260\347\273\204\345\222\214.md" | 12 +++------ ...60\347\232\204\346\225\260\351\207\217.md" | 12 +++------ ...70\344\272\244\347\232\204\347\272\277.md" | 12 +++------ ...73\351\207\215\345\244\215\351\241\271.md" | 12 +++------ ...\347\232\204\351\207\215\351\207\217II.md" | 12 +++------ ...61\345\255\220\345\272\217\345\210\227.md" | 12 +++------ ...72\347\216\260\346\254\241\346\225\260.md" | 12 +++------ ...41\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...77\347\232\204\346\225\260\347\233\256.md" | 12 +++------ ...21\347\232\204\345\237\216\345\270\202.md" | 12 +++------ ...60\347\233\256\346\216\222\345\272\217.md" | 12 +++------ ...27\347\232\204\346\225\260\345\255\227.md" | 12 +++------ ...21\345\217\230\345\271\263\350\241\241.md" | 12 +++------ ...55\345\277\203\350\212\202\347\202\271.md" | 12 +++------ ...30\345\234\250\350\267\257\345\276\204.md" | 12 +++------ ...57\345\244\232\345\244\247\357\274\237.md" | 12 +++------ ...44\270\262\346\216\245\351\276\231-03.png" | Bin 0 -> 56769 bytes problems/toolgithub.sh | 24 +++++++++++------- ...11\346\255\245\351\223\272\345\236\253.md" | 12 +++------ ...46\347\235\200\345\233\236\346\272\257.md" | 12 +++------ ...21\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...00\350\277\255\344\273\243\346\263\225.md" | 12 +++------ ...55\344\273\243\351\201\215\345\216\206.md" | 12 +++------ ...22\345\275\222\351\201\215\345\216\206.md" | 12 +++------ ...77\346\215\242\347\251\272\346\240\274.md" | 12 +++------ ...54\345\255\227\347\254\246\344\270\262.md" | 12 +++------ ...30\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...22\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...07\351\222\210\346\200\273\347\273\223.md" | 12 +++------ ...14\350\241\250\346\200\273\347\273\223.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...36\346\272\257\346\200\273\347\273\223.md" | 12 +++------ ...00\347\247\215\345\206\231\346\263\225.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...46\344\270\262\346\200\273\347\273\223.md" | 12 +++------ ...04\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...37\345\210\227\346\200\273\347\273\223.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...06\350\256\262\350\247\243\357\274\211.md" | 12 +++------ ...27\346\263\225\346\250\241\346\235\277.md" | 12 +++------ ...05\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...47\241\20001\350\203\214\345\214\205-1.md" | 12 +++------ ...47\241\20001\350\203\214\345\214\205-2.md" | 12 +++------ ...14\345\214\205\344\270\200\347\273\264.md" | 3 +++ ...32\351\207\215\350\203\214\345\214\205.md" | 12 +++------ ...14\345\205\250\350\203\214\345\214\205.md" | 12 +++------ ...25\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...50\346\200\273\347\273\223\347\257\207.md" | 12 +++------ ...06\350\256\272\345\237\272\347\241\200.md" | 12 +++------ ...76\350\241\250\347\233\270\344\272\244.md" | 12 +++------ 224 files changed, 681 insertions(+), 1980 deletions(-) create mode 100644 "problems/images/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231-03.png" diff --git "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" index e982ae129b..6be92fa81b 100644 --- "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1. 两数之和 @@ -557,7 +555,3 @@ int* twoSum(int* nums, int numsSize, int target, int* returnSize){ } ``` -

- - - diff --git "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" index b3d3b93896..4ce49810b3 100644 --- "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -731,8 +729,4 @@ public class Solution { ``` -

- - - diff --git "a/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" "b/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" index 1685db7452..52dbdab7b5 100644 --- "a/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -980,7 +978,3 @@ object Solution { } ``` -

- - - diff --git "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" index 9a320ca0e6..93f41e0f74 100644 --- "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" +++ "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 17.电话号码的字母组合 @@ -766,7 +764,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" "b/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" index f3188b0f13..bf7d3bd4ee 100644 --- "a/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 一样的道理,能解决四数之和 @@ -798,8 +796,4 @@ def four_sum(nums, target) end ``` -

- - - diff --git "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" index 16312d0fc4..53b59039e5 100644 --- "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" +++ "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -479,7 +477,3 @@ public class Solution { } } ``` -

- - - diff --git "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" index 2475138ebb..c642fb4ecd 100644 --- "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" +++ "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -574,8 +572,4 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" "b/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" index 305bb7ccba..b9494297e4 100644 --- "a/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" +++ "b/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 24. 两两交换链表中的节点 @@ -527,7 +525,3 @@ public ListNode SwapPairs(ListNode head) } ``` -

- - - diff --git "a/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" "b/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" index 10817ba6b7..d01765ff66 100644 --- "a/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" +++ "b/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 27. 移除元素 @@ -519,7 +517,3 @@ int removeElement(List nums, int val) { ``` -

- - - diff --git "a/problems/0028.\345\256\236\347\216\260strStr.md" "b/problems/0028.\345\256\236\347\216\260strStr.md" index 63a08d960d..b25cb301f9 100644 --- "a/problems/0028.\345\256\236\347\216\260strStr.md" +++ "b/problems/0028.\345\256\236\347\216\260strStr.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 在一个串中查找是否出现过另一个串,这是KMP的看家本领。 @@ -1520,7 +1518,3 @@ int strStr(char* haystack, char* needle) { } ``` -

- - - diff --git "a/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" "b/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" index 48af8d0da1..95bb1d899e 100644 --- "a/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" +++ "b/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -269,7 +267,3 @@ var nextPermutation = function(nums) { -

- - - diff --git "a/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" "b/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" index 16adcdf19c..37248e4819 100644 --- "a/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" +++ "b/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 34. 在排序数组中查找元素的第一个和最后一个位置 @@ -855,7 +853,3 @@ int* searchRange(int* nums, int numsSize, int target, int* returnSize){ ``` -

- - - diff --git "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" index b5be9a5f8b..e0b065cd5a 100644 --- "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" +++ "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -549,7 +547,3 @@ int searchInsert(int* nums, int numsSize, int target){ ``` -

- - - diff --git "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" index 5f3f881cf1..b26bf53308 100644 --- "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" +++ "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -893,7 +891,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" index 92c68562da..455bd697cd 100644 --- "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" +++ "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -661,7 +659,3 @@ public class Solution -

- - - diff --git "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" index 22cf726d8c..281db4dc86 100644 --- "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" +++ "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 这篇可以说是全网把组合问题如何去重,讲的最清晰的了! @@ -807,7 +805,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" index 0484f830f6..8a424e3ea2 100644 --- "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" +++ "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1095,7 +1093,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" index 8919d39367..a20eb2a6a9 100644 --- "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" +++ "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 相对于[贪心算法:跳跃游戏](https://mp.weixin.qq.com/s/606_N9j8ACKCODoCbV1lSA)难了不少,做好心理准备! @@ -542,7 +540,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" index ca465efd6f..611a4cb1e0 100644 --- "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" +++ "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 46.全排列 @@ -521,8 +519,4 @@ public class Solution ``` -

- - - diff --git "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" index 08e3c616a2..1e51a7bcd7 100644 --- "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" +++ "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -555,7 +553,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0051.N\347\232\207\345\220\216.md" "b/problems/0051.N\347\232\207\345\220\216.md" index 38fc07e790..b201b55fe4 100644 --- "a/problems/0051.N\347\232\207\345\220\216.md" +++ "b/problems/0051.N\347\232\207\345\220\216.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 51. N皇后 @@ -921,7 +919,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0052.N\347\232\207\345\220\216II.md" "b/problems/0052.N\347\232\207\345\220\216II.md" index 271484a4ee..11c257b073 100644 --- "a/problems/0052.N\347\232\207\345\220\216II.md" +++ "b/problems/0052.N\347\232\207\345\220\216II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -307,7 +305,3 @@ class Solution { } ``` -

- - - diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" index 705a00d7a8..6f8c2a6e7e 100644 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 53. 最大子序和 @@ -492,7 +490,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" index 38a3a11818..568626dc6d 100644 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 53. 最大子序和 @@ -244,7 +242,3 @@ function maxSubArray(nums: number[]): number { -

- - - diff --git "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" index 3b7afb9099..7d7f460f01 100644 --- "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" +++ "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -485,7 +483,3 @@ func min(x, y int) int { ``` -

- - - diff --git "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" index 896dc998d1..3ab004b2aa 100644 --- "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" +++ "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 55. 跳跃游戏 @@ -293,7 +291,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" index 538be69336..76792dbae1 100644 --- "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" +++ "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 56. 合并区间 @@ -405,7 +403,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" index 94966126b9..9961c0e70b 100644 --- "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" +++ "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -829,7 +827,3 @@ def generate_matrix(n) end ``` -

- - - diff --git "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" index 7025135ade..23cd8060fa 100644 --- "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" +++ "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -616,7 +614,3 @@ public class Solution -

- - - diff --git "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" index 13923abeca..61d9329d4b 100644 --- "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" +++ "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -781,7 +779,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" index 6a13a21cdb..92c3858698 100644 --- "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 70. 爬楼梯 @@ -520,8 +518,4 @@ impl Solution { ``` -

- - - diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" index c51a590baf..a5435ddd71 100644 --- "a/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" +++ "b/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 70. 爬楼梯(进阶版) @@ -252,7 +250,3 @@ var climbStairs = function (n: number): number { ### Rust: -

- - - diff --git "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" index 0da3bf5093..408999d873 100644 --- "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" +++ "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 72. 编辑距离 @@ -462,7 +460,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0077.\347\273\204\345\220\210.md" "b/problems/0077.\347\273\204\345\220\210.md" index c4be5a3804..60900d76a6 100644 --- "a/problems/0077.\347\273\204\345\220\210.md" +++ "b/problems/0077.\347\273\204\345\220\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 第77题. 组合 @@ -876,7 +874,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" index 0fa568afe9..e2ca3d7d0a 100644 --- "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" +++ "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -412,7 +410,3 @@ object Solution { ``` -

- - - diff --git "a/problems/0078.\345\255\220\351\233\206.md" "b/problems/0078.\345\255\220\351\233\206.md" index 0c368b41ed..73eb385bc1 100644 --- "a/problems/0078.\345\255\220\351\233\206.md" +++ "b/problems/0078.\345\255\220\351\233\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 78.子集 @@ -492,7 +490,3 @@ public class Solution { -

- - - diff --git "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" index 5c6f407321..6577cf542d 100644 --- "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" +++ "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 84.柱状图中最大的矩形 @@ -863,7 +861,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0090.\345\255\220\351\233\206II.md" "b/problems/0090.\345\255\220\351\233\206II.md" index 811d3cc005..3bda02bc9e 100644 --- "a/problems/0090.\345\255\220\351\233\206II.md" +++ "b/problems/0090.\345\255\220\351\233\206II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 90.子集II @@ -697,7 +695,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" index a03a0e3b15..1a89827897 100644 --- "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" +++ "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -876,7 +874,3 @@ public class Solution -

- - - diff --git "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index 25d79aff74..f4e0e456b7 100644 --- "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -348,7 +346,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index fb4ca7d88d..22a47f9632 100644 --- "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 98.验证二叉搜索树 @@ -807,7 +805,3 @@ public bool IsValidBST(TreeNode root) ``` -

- - - diff --git "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" index 7268b9f083..52c9fcf2e7 100644 --- "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" +++ "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -340,7 +338,3 @@ function isSameTree(p: TreeNode | null, q: TreeNode | null): boolean { -

- - - diff --git "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" index 31c24fc5aa..f066408408 100644 --- "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 101. 对称二叉树 @@ -946,8 +944,4 @@ public bool IsSymmetric(TreeNode root) ``` -

- - - diff --git "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" index ce53e49af9..da2d85c99d 100644 --- "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" +++ "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -3601,7 +3599,3 @@ impl Solution { **致敬叶师傅!** -

- - - diff --git "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" index fdc9009603..6b9994ed93 100644 --- "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" +++ "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1195,7 +1193,3 @@ public int MaxDepth(TreeNode root) -

- - - diff --git "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" index bde61a7551..d0af8fef27 100644 --- "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1351,7 +1349,3 @@ public TreeNode BuildTree(int[] inorder, int[] postorder) ``` -

- - - diff --git "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index 4804ccd3b3..adb2a06082 100644 --- "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 构造二叉搜索树,一不小心就平衡了 @@ -562,7 +560,3 @@ public TreeNode Traversal(int[] nums, int left, int right) -

- - - diff --git "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" index a4339ac3d7..c3da728077 100644 --- "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -998,7 +996,3 @@ public int GetHeight(TreeNode root) ``` -

- - - diff --git "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" index 708e0532f8..a77594b28f 100644 --- "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" +++ "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 和求最大深度一个套路? @@ -752,7 +750,3 @@ public int MinDepth(TreeNode root) } ``` -

- - - diff --git "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" index 141967f593..22ed777fba 100644 --- "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" +++ "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1624,8 +1622,4 @@ public class Solution { ``` -

- - - diff --git "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" index cf24c4c180..832b64d183 100644 --- "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 115.不同的子序列 @@ -376,7 +374,3 @@ impl Solution { -

- - - diff --git "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" index 98bd4e41c1..234929f3d1 100644 --- "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" +++ "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 116. 填充每个节点的下一个右侧节点指针 @@ -489,8 +487,4 @@ public class Solution -

- - - diff --git "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" index f8092503e3..b9df47a491 100644 --- "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" +++ "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 121. 买卖股票的最佳时机 @@ -627,7 +625,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" index 6663a66d12..b268040771 100644 --- "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" +++ "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 122.买卖股票的最佳时机 II @@ -423,7 +421,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" index 0dced9efd4..d8cb308b7e 100644 --- "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 122.买卖股票的最佳时机II @@ -477,7 +475,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" index 1b7c09d214..75f7cb3f20 100644 --- "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" +++ "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 123.买卖股票的最佳时机III @@ -565,7 +563,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" index 00d7d4cfc4..556613e587 100644 --- "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" +++ "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 127. 单词接龙 @@ -360,7 +358,3 @@ function diffonechar(word1: string, word2: string): boolean { ``` -

- - - diff --git "a/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" "b/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" index 90dfd0618f..923bc63807 100644 --- "a/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" +++ "b/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -383,7 +381,3 @@ int sumNumbers(struct TreeNode* root){ ``` -

- - - diff --git "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" index 8ef8d5b280..4eeb57143e 100644 --- "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" +++ "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 130. 被围绕的区域 @@ -793,7 +791,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" "b/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" index 4eca0ddf53..f9b5d244c5 100644 --- "a/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" +++ "b/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 切割问题其实是一种组合问题! @@ -1007,7 +1005,3 @@ public class Solution -

- - - diff --git "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" index 85e047f2b7..2117a44801 100644 --- "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" +++ "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -373,7 +371,3 @@ var minCut = function(s) { -

- - - diff --git "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" index 0248760da6..fdf3e0d3db 100644 --- "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" +++ "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 134. 加油站 @@ -709,7 +707,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" index eb2081fe3f..75cce157c6 100644 --- "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" +++ "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 135. 分发糖果 @@ -401,7 +399,3 @@ public class Solution -

- - - diff --git "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" index 29748e2780..b74d2cdfa0 100644 --- "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" +++ "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -565,7 +563,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" index ac6565763f..4957e9fbd5 100644 --- "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" +++ "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 141. 环形链表 @@ -160,7 +158,3 @@ function hasCycle(head: ListNode | null): boolean { -

- - - diff --git "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" index 7cda58c396..fb8b875f7d 100644 --- "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" +++ "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -465,7 +463,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" index ccddef5bf0..c61eb4b403 100644 --- "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" +++ "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 143.重排链表 @@ -689,7 +687,3 @@ void reorderList(struct ListNode* head){ ``` -

- - - diff --git "a/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" "b/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" index bc73f6da0d..6d21452d1d 100644 --- "a/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" +++ "b/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 这不仅仅是一道好题,也展现出计算机的思考方式 @@ -550,7 +548,3 @@ int evalRPN(char** tokens, int tokensSize) { } ``` -

- - - diff --git "a/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" "b/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" index 3dbd59b916..b5246a7dbb 100644 --- "a/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" +++ "b/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1086,8 +1084,4 @@ public string ReverseWords(string s) { } ``` -

- - - diff --git "a/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" "b/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" index d4422bd8ba..cdc58912fe 100644 --- "a/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" +++ "b/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" @@ -1,11 +1,5 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) 同:[链表:链表相交](https://programmercarl.com/面试题02.07.链表相交.html) -

- - - diff --git "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" index cbba12c9d1..b182d4d03d 100644 --- "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" +++ "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 188.买卖股票的最佳时机IV @@ -641,8 +639,4 @@ impl Solution { -

- - - diff --git "a/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" "b/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" index e91109c692..976cbed4d1 100644 --- "a/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" +++ "b/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 189. 旋转数组 @@ -212,7 +210,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" index 032204bbce..3d06c95241 100644 --- "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" +++ "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 198.打家劫舍 @@ -361,7 +359,3 @@ impl Solution { -

- - - diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" index 00e4efd894..4901934bfe 100644 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 200. 岛屿数量 @@ -410,7 +408,3 @@ impl Solution { ``` ``` -

- - - diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" index 4657920334..a3f6f48c76 100644 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 200. 岛屿数量 @@ -463,7 +461,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0202.\345\277\253\344\271\220\346\225\260.md" "b/problems/0202.\345\277\253\344\271\220\346\225\260.md" index 39cb39fa31..fdcadee97c 100644 --- "a/problems/0202.\345\277\253\344\271\220\346\225\260.md" +++ "b/problems/0202.\345\277\253\344\271\220\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -558,7 +556,3 @@ def next_value(n) end ``` -

- - - diff --git "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" index 5a4bbb7423..9a38aaa152 100644 --- "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" +++ "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -808,7 +806,3 @@ end ``` -

- - - diff --git "a/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" "b/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" index e416d9ceda..ba255e0685 100644 --- "a/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 205. 同构字符串 @@ -180,7 +178,3 @@ function isIsomorphic(s: string, t: string): boolean { -

- - - diff --git "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" index 430bebe59b..7509882f08 100644 --- "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" +++ "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 反转链表的写法很简单,一些同学甚至可以背下来但过一阵就忘了该咋写,主要是因为没有理解真正的反转过程。 @@ -739,7 +737,3 @@ public ListNode reverseList(ListNode head) { > 采用这种方法需要注意一点。就是当整个出栈循环结束以后,cur正好指向原来链表的第一个结点,而此时结点1中的next指向的是结点2,因此最后还需要`cur.next = null` ![image-20230117195418626](https://raw.githubusercontent.com/liyuxuan7762/MyImageOSS/master/md_images/image-20230117195418626.png) -

- - - diff --git "a/problems/0207.\350\257\276\347\250\213\350\241\250.md" "b/problems/0207.\350\257\276\347\250\213\350\241\250.md" index dff0b18eb0..f992c72b89 100644 --- "a/problems/0207.\350\257\276\347\250\213\350\241\250.md" +++ "b/problems/0207.\350\257\276\347\250\213\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) 拓扑排序指的是一种 解决问题的大体思路, 而具体算法,可能是 广搜 可能是深搜。 @@ -59,7 +57,3 @@ public: } }; ``` -

- - - diff --git "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" index c6d89976d0..43a3cb6a2b 100644 --- "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 209.长度最小的子数组 @@ -558,7 +556,3 @@ public class Solution { } } ``` -

- - - diff --git "a/problems/0210.\350\257\276\347\250\213\350\241\250II.md" "b/problems/0210.\350\257\276\347\250\213\350\241\250II.md" index 2d2e242941..b0d9fe8a9e 100644 --- "a/problems/0210.\350\257\276\347\250\213\350\241\250II.md" +++ "b/problems/0210.\350\257\276\347\250\213\350\241\250II.md" @@ -1,3 +1,6 @@ +* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) ```CPP class Solution { diff --git "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" index 05ebd1ad09..536e1e89b8 100644 --- "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" +++ "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 213.打家劫舍II @@ -367,7 +365,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" index 3d7f2d0c03..3dbd676a8d 100644 --- "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" +++ "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -739,7 +737,3 @@ public class Solution -

- - - diff --git "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" index 8d7779f989..9b649d7be8 100644 --- "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" +++ "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 222.完全二叉树的节点个数 @@ -894,7 +892,3 @@ public int CountNodes(TreeNode root) ``` -

- - - diff --git "a/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" "b/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" index 73d9db1b16..2396858056 100644 --- "a/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" +++ "b/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1367,7 +1365,3 @@ void myStackFree(MyStack* obj) { ``` -

- - - diff --git "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" index c34ca4bfcb..0980e6004c 100644 --- "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 226.翻转二叉树 @@ -1022,7 +1020,3 @@ public TreeNode InvertTree(TreeNode root) { ``` -

- - - diff --git "a/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" "b/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" index 657567cfdf..6775a37265 100644 --- "a/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" +++ "b/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 工作上一定没人这么搞,但是考察对栈、队列理解程度的好题 @@ -691,7 +689,3 @@ impl MyQueue { } ``` -

- - - diff --git "a/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" "b/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" index 1356b7da3b..f493383967 100644 --- "a/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" +++ "b/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 234.回文链表 @@ -429,7 +427,3 @@ function reverseList(head: ListNode | null): ListNode | null { -

- - - diff --git "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" index 3911261a53..c5eb603a0d 100644 --- "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 235. 二叉搜索树的最近公共祖先 @@ -548,7 +546,3 @@ public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) -

- - - diff --git "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" index 8cd505a829..f15d1cff60 100644 --- "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 本来是打算将二叉树和二叉搜索树的公共祖先问题一起讲,后来发现篇幅过长了,只能先说一说二叉树的公共祖先问题。 @@ -491,7 +489,3 @@ public TreeNode LowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) ``` -

- - - diff --git "a/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" "b/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" index 651e4da40c..875f1bd193 100644 --- "a/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" +++ "b/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -922,8 +920,4 @@ int* maxSlidingWindow(int* nums, int numsSize, int k, int* returnSize) { ``` -

- - - diff --git "a/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" "b/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" index 61488f03fd..9a783e5b11 100644 --- "a/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" +++ "b/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 数组就是简单的哈希表,但是数组的大小可不是无限开辟的 @@ -416,7 +414,3 @@ bool isAnagram(char* s, char* t) { -

- - - diff --git "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" index fdaa87f896..287db20937 100644 --- "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" +++ "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 以为只用了递归,其实还用了回溯 @@ -938,7 +936,3 @@ public void Traversal(TreeNode node, List path, List res) } ``` -

- - - diff --git "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" index dc5a7e9ec9..c1077bd43d 100644 --- "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" +++ "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 279.完全平方数 @@ -479,7 +477,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0283.\347\247\273\345\212\250\351\233\266.md" "b/problems/0283.\347\247\273\345\212\250\351\233\266.md" index cbce029576..d7911054e4 100644 --- "a/problems/0283.\347\247\273\345\212\250\351\233\266.md" +++ "b/problems/0283.\347\247\273\345\212\250\351\233\266.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 283. 移动零:动态规划:一样的套路,再求一次完全平方数 @@ -186,7 +184,3 @@ impl Solution { -

- - - diff --git "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" index 442938c06f..7d2e488623 100644 --- "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 300.最长递增子序列 @@ -361,7 +359,3 @@ func lengthOfLIS(nums: Array): Int64 { ``` -

- - - diff --git "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" index b98a416cc1..6a81933505 100644 --- "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" +++ "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 309.最佳买卖股票时机含冷冻期 @@ -603,8 +601,4 @@ impl Solution { ``` -

- - - diff --git "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" index e55e20bedf..dea77a3d10 100644 --- "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" +++ "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 322. 零钱兑换 @@ -499,7 +497,3 @@ function coinChange(coins: number[], amount: number): number { ``` -

- - - diff --git "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" index 78e1407419..f1df25229d 100644 --- "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" +++ "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 这也可以用回溯法? 其实深搜和回溯也是相辅相成的,毕竟都用递归。 @@ -941,7 +939,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" index a3130df7ee..08728e4faf 100644 --- "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" +++ "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 337.打家劫舍 III @@ -623,7 +621,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" index 5d0110f67e..06549185a3 100644 --- "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" +++ "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 343. 整数拆分 @@ -564,7 +562,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" "b/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" index 793c9af362..c88d008c82 100644 --- "a/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -429,7 +427,3 @@ object Solution { } } ``` -

- - - diff --git "a/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" "b/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" index cca9b0edce..b6575c5fd4 100644 --- "a/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" +++ "b/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 前K个大数问题,老生常谈,不得不谈 @@ -609,8 +607,4 @@ impl Solution { ``` -

- - - diff --git "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" index 93fa09318a..5066bff1b9 100644 --- "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" +++ "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -544,8 +542,4 @@ end * [350.两个数组的交集 II](https://leetcode.cn/problems/intersection-of-two-arrays-ii/) -

- - - diff --git "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" index e2ea99046b..886d86aefe 100644 --- "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" +++ "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 376. 摆动序列 @@ -714,7 +712,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" index ba8546c662..d2feb0c5d6 100644 --- "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" +++ "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 377. 组合总和 Ⅳ @@ -357,7 +355,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0383.\350\265\216\351\207\221\344\277\241.md" "b/problems/0383.\350\265\216\351\207\221\344\277\241.md" index 1d7391732f..8a2f52ae42 100644 --- "a/problems/0383.\350\265\216\351\207\221\344\277\241.md" +++ "b/problems/0383.\350\265\216\351\207\221\344\277\241.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -466,8 +464,4 @@ bool canConstruct(char* ransomNote, char* magazine) { ``` -

- - - diff --git "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" index 92246e4f9b..2a5be51c59 100644 --- "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 392.判断子序列 @@ -405,7 +403,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" index 66aff68f2e..0efdb6f663 100644 --- "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" +++ "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 404.左叶子之和 @@ -685,7 +683,3 @@ public int SumOfLeftLeaves(TreeNode root) ``` -

- - - diff --git "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" index d6fc415b68..11853e1170 100644 --- "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" +++ "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 406.根据身高重建队列 @@ -422,7 +420,3 @@ public class Solution -

- - - diff --git "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" index 902c022ab3..9cc6db0e4b 100644 --- "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" +++ "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 416. 分割等和子集 @@ -801,7 +799,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" index 5156ce2289..ec87eb9595 100644 --- "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" +++ "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -837,7 +835,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" index d6321315d7..a37d1cadac 100644 --- "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" +++ "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 435. 无重叠区间 @@ -495,7 +493,3 @@ public class Solution -

- - - diff --git "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" index 831655e8e1..7280918460 100644 --- "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" +++ "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 二叉搜索树删除节点就涉及到结构调整了 @@ -836,7 +834,3 @@ def delete_node(root, key) end ``` -

- - - diff --git "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" index 14456f92bf..854498829b 100644 --- "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" +++ "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 452. 用最少数量的箭引爆气球 @@ -357,7 +355,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" "b/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" index af19f5f7d8..a26071a1fa 100644 --- "a/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" +++ "b/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 需要哈希的地方都能找到map的身影 @@ -526,7 +524,3 @@ def two_sum_mapping(nums1, nums2) end ``` -

- - - diff --git "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" index 5e8fb73094..a2a1b1f339 100644 --- "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" +++ "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 455.分发饼干 @@ -434,7 +432,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" index 988b2abf11..78aad3e786 100644 --- "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > KMP算法还能干这个 @@ -999,7 +997,3 @@ bool repeatedSubstringPattern(char* s) { ``` -

- - - diff --git "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" index 5261d6c2ae..bff619ccde 100644 --- "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" +++ "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -433,7 +431,3 @@ function islandPerimeter(grid: number[][]): number { ``` -

- - - diff --git "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" index 9d24f01434..ca525ab2e3 100644 --- "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" +++ "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 474.一和零 @@ -740,8 +738,4 @@ public class Solution ``` -

- - - diff --git "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" index 7832095a10..1b927dd3d2 100644 --- "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 和子集问题有点像,但又处处是陷阱 @@ -640,7 +638,3 @@ public class Solution { } ``` -

- - - diff --git "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" index c38ba7e43c..bde843ead3 100644 --- "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" +++ "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -1024,8 +1022,4 @@ public class Solution ``` -

- - - diff --git "a/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" "b/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" index 02e73a588d..628149b75d 100644 --- "a/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" +++ "b/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 496.下一个更大元素 I @@ -507,7 +505,3 @@ impl Solution { -

- - - diff --git "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" index c89f8031e8..32a89e859a 100644 --- "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" +++ "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 二叉树上应该怎么求,二叉搜索树上又应该怎么求? @@ -1052,7 +1050,3 @@ public class Solution -

- - - diff --git "a/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" "b/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" index b466337d6e..93924483f3 100644 --- "a/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" +++ "b/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 503.下一个更大元素II @@ -358,7 +356,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" "b/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" index ac173dbddc..b2e56a613c 100644 --- "a/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" +++ "b/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 509. 斐波那契数 @@ -476,7 +474,3 @@ public class Solution -

- - - diff --git "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" index c7446726f8..da37360374 100644 --- "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" +++ "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 513.找树左下角的值 @@ -764,7 +762,3 @@ public class Solution // @lc code=end ``` -

- - - diff --git "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" index 166310aaff..f0ef2f53d0 100644 --- "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -299,7 +297,3 @@ impl Solution { -

- - - diff --git "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" index 835df85212..1698db9887 100644 --- "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" +++ "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 518.零钱兑换II @@ -589,7 +587,3 @@ public class Solution ``` -

- - - diff --git "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" index b6d08dbeaa..d7b0e056db 100644 --- "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" +++ "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 利用二叉搜索树的特性搞起! @@ -679,8 +677,4 @@ public class Solution ``` -

- - - diff --git "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" index b95b585485..1bbbdac76d 100644 --- "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" +++ "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 538.把二叉搜索树转换为累加树 @@ -549,7 +547,3 @@ public class Solution -

- - - diff --git "a/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" "b/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" index b3e7b02229..2bbe6cffae 100644 --- "a/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" +++ "b/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -516,8 +514,4 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" index b9f9ad9625..a86dfad195 100644 --- "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" +++ "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 583. 两个字符串的删除操作 @@ -470,7 +468,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" index 530350ac69..f180c4f3b9 100644 --- "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 617.合并二叉树 @@ -804,7 +802,3 @@ public TreeNode MergeTrees(TreeNode root1, TreeNode root2) ``` -

- - - diff --git "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" index cf32d7ed24..e2783027aa 100644 --- "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 647. 回文子串 @@ -613,7 +611,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" "b/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" index 1540a60173..e77070fcf8 100644 --- "a/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" +++ "b/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -284,7 +282,3 @@ function predictPartyVictory(senate: string): string { -

- - - diff --git "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" index fed9b2b991..9f897a7502 100644 --- "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 654.最大二叉树 @@ -599,7 +597,3 @@ public TreeNode ConstructMaximumBinaryTree(int[] nums) ``` -

- - - diff --git "a/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" "b/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" index eccfef3a21..89993b6ff6 100644 --- "a/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" +++ "b/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 657. 机器人能否返回原点 @@ -182,7 +180,3 @@ var judgeCircle = function (moves) { -

- - - diff --git "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index 325733862c..0a05360bf1 100644 --- "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -587,7 +585,3 @@ public TreeNode TrimBST(TreeNode root, int low, int high) -

- - - diff --git "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" index 0366ee8063..9bfa91cc94 100644 --- "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" +++ "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 673.最长递增子序列的个数 @@ -361,7 +359,3 @@ var findNumberOfLIS = function(nums) { -

- - - diff --git "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" index 8b967092bc..2c490c0c5b 100644 --- "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" +++ "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 674. 最长连续递增序列 @@ -514,7 +512,3 @@ func findLengthOfLCIS(nums: Array): Int64 { -

- - - diff --git "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" index 7808549036..e6d2d8e502 100644 --- "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" +++ "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 684.冗余连接 @@ -379,7 +377,3 @@ var findRedundantConnection = function(edges) { -

- - - diff --git "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" index 3f489d82b7..7b0e320c6f 100644 --- "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" +++ "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 685.冗余连接II @@ -620,7 +618,3 @@ var findRedundantDirectedConnection = function(edges) { -

- - - diff --git "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" index ca70420687..0b84e651c1 100644 --- "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" +++ "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 695. 岛屿的最大面积 @@ -709,7 +707,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" index 9ec51524b8..4225b3fe25 100644 --- "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" +++ "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 700.二叉搜索树中的搜索 @@ -508,7 +506,3 @@ public TreeNode SearchBST(TreeNode root, int val) ``` -

- - - diff --git "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" index 25d39486f3..ef383faa86 100644 --- "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" +++ "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 701.二叉搜索树中的插入操作 @@ -724,7 +722,3 @@ public TreeNode InsertIntoBST(TreeNode root, int val) { ``` -

- - - diff --git "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" index d86146d63a..405018745e 100644 --- "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" +++ "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 704. 二分查找 @@ -837,7 +835,3 @@ class Solution { ``` -

- - - diff --git "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" index 5c72b05a29..7023bd902a 100644 --- "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" +++ "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 听说这道题目把链表常见的五个操作都覆盖了? @@ -1845,8 +1843,4 @@ public class MyLinkedList } ``` -

- - - diff --git "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" index e742b8c89b..fb095d7518 100644 --- "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" +++ "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 714. 买卖股票的最佳时机含手续费 @@ -361,7 +359,3 @@ object Solution { ``` -

- - - diff --git "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" index 17997b6208..ebed4a0b30 100644 --- "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 714.买卖股票的最佳时机含手续费 @@ -337,7 +335,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" index 1391926a76..0e4b346d82 100644 --- "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 718. 最长重复子数组 @@ -602,7 +600,3 @@ func findLength(nums1: Array, nums2: Array): Int64 { ``` -

- - - diff --git "a/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" "b/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" index a66a445083..bccca4f2d4 100644 --- "a/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" +++ "b/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 724.寻找数组的中心下标 @@ -159,7 +157,3 @@ function pivotIndex(nums: number[]): number { -

- - - diff --git "a/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" "b/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" index f2cfee04c9..17182778ae 100644 --- "a/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" +++ "b/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 738.单调递增的数字 @@ -441,8 +439,4 @@ public class Solution } ``` -

- - - diff --git "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" index dd633aed9a..542aad29b8 100644 --- "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" +++ "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -515,7 +513,3 @@ impl Solution { -

- - - diff --git "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" index e631951a9e..6533a240bf 100644 --- "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" +++ "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" @@ -1,3 +1,6 @@ +* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 743.网络延迟时间 diff --git "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" index 753a104d97..9145c7ed1d 100644 --- "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -538,7 +536,3 @@ public class Solution -

- - - diff --git "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" index 19d862db14..70ebfe4ff7 100644 --- "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" +++ "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 763.划分字母区间 @@ -462,7 +460,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" index 9c0a8e7f27..68d8421502 100644 --- "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" +++ "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 787. K 站中转内最便宜的航班 @@ -180,7 +178,3 @@ public: -

- - - diff --git "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" index 40e1bbe73e..a37e5c3f8c 100644 --- "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" +++ "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 797.所有可能的路径 @@ -294,7 +292,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" index d24eaacc50..0ebda2524a 100644 --- "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" +++ "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 827.最大人工岛 @@ -504,7 +502,3 @@ return res; ``` -

- - - diff --git "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" index b78693b446..4076fce513 100644 --- "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" +++ "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -484,7 +482,3 @@ function canVisitAllRooms(rooms: number[][]): boolean { ``` -

- - - diff --git "a/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" "b/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" index c32cdd339b..f229447384 100644 --- "a/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 844.比较含退格的字符串 @@ -588,7 +586,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" "b/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" index b7887d456e..aeb470fe5a 100644 --- "a/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" +++ "b/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 860.柠檬水找零 @@ -440,7 +438,3 @@ public class Solution -

- - - diff --git "a/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" "b/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" index 28680dbf0f..484099f89f 100644 --- "a/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" +++ "b/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -410,7 +408,3 @@ function sortArrayByParityII(nums: number[]): number[] { ``` -

- - - diff --git "a/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" "b/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" index f4a8fa8e52..47465199a8 100644 --- "a/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" +++ "b/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 925.长按键入 @@ -227,7 +225,3 @@ function isLongPressedName(name: string, typed: string): boolean { -

- - - diff --git "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" index 77167df041..383f6aa5b1 100644 --- "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" +++ "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 941.有效的山脉数组 @@ -213,7 +211,3 @@ impl Solution { } ``` -

- - - diff --git "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" index 327c54f72a..0df2cc5b60 100644 --- "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -789,7 +787,3 @@ public class Solution } ``` -

- - - diff --git "a/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" "b/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" index b8488e10de..6e58be1af6 100644 --- "a/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" +++ "b/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 双指针风骚起来,也是无敌 @@ -588,8 +586,4 @@ public class Solution { } ``` -

- - - diff --git "a/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" "b/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" index f938c2b734..3d7d8e0770 100644 --- "a/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" +++ "b/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -582,7 +580,3 @@ end ``` -

- - - diff --git "a/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" "b/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" index 1a7817775a..6e908d5af6 100644 --- "a/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" +++ "b/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1005.K次取反后最大化的数组和 @@ -377,7 +375,3 @@ public class Solution -

- - - diff --git "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" index f708e4a368..030d56a024 100644 --- "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" +++ "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1020. 飞地的数量 @@ -753,8 +751,4 @@ impl Solution { -

- - - diff --git "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" index 5164e1f7ff..53e0f370e7 100644 --- "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" +++ "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1035.不相交的线 @@ -278,7 +276,3 @@ function maxUncrossedLines(nums1: number[], nums2: number[]): number { -

- - - diff --git "a/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" "b/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" index 51ec4e62c6..01d33fbff7 100644 --- "a/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" +++ "b/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 匹配问题都是栈的强项 @@ -523,7 +521,3 @@ end ``` -

- - - diff --git "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" index 0d445a71f0..62e7d9c590 100644 --- "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" +++ "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1049.最后一块石头的重量II @@ -535,7 +533,3 @@ public class Solution ``` -

- - - diff --git "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" index 6d05ccf3f8..821f3c42a1 100644 --- "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1143.最长公共子序列 @@ -420,7 +418,3 @@ func longestCommonSubsequence(text1: String, text2: String): Int64 { ``` -

- - - diff --git "a/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" "b/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" index 781badf549..fbb19af773 100644 --- "a/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" +++ "b/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1207.独一无二的出现次数 @@ -247,7 +245,3 @@ impl Solution { -

- - - diff --git "a/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" "b/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" index a32ca98ffc..a9e275d92d 100644 --- "a/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1221. 分割平衡字符串 @@ -172,7 +170,3 @@ function balancedStringSplit(s: string): number { }; ``` -

- - - diff --git "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" index 3d7b9fe96c..5d99670950 100644 --- "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" +++ "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1254. 统计封闭岛屿的数目 @@ -136,7 +134,3 @@ var closedIsland = function(grid) { -

- - - diff --git "a/problems/1334.\351\230\210\345\200\274\350\267\235\347\246\273\345\206\205\351\202\273\345\261\205\346\234\200\345\260\221\347\232\204\345\237\216\345\270\202.md" "b/problems/1334.\351\230\210\345\200\274\350\267\235\347\246\273\345\206\205\351\202\273\345\261\205\346\234\200\345\260\221\347\232\204\345\237\216\345\270\202.md" index d8d8861f47..bea47a2e63 100644 --- "a/problems/1334.\351\230\210\345\200\274\350\267\235\347\246\273\345\206\205\351\202\273\345\261\205\346\234\200\345\260\221\347\232\204\345\237\216\345\270\202.md" +++ "b/problems/1334.\351\230\210\345\200\274\350\267\235\347\246\273\345\206\205\351\202\273\345\261\205\346\234\200\345\260\221\347\232\204\345\237\216\345\270\202.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) floyd @@ -49,7 +47,3 @@ public: return result; } }; -

- - - diff --git "a/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" "b/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" index 9cfb674328..0ae1603494 100644 --- "a/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" +++ "b/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -217,7 +215,3 @@ var sortByBits = function(arr) { -

- - - diff --git "a/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" "b/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" index f0a77f5587..2cb73f728a 100644 --- "a/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" +++ "b/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -311,7 +309,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" index 120cafffd3..7a1a7f3cb9 100644 --- "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" +++ "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1382.将二叉搜索树变平衡 @@ -218,7 +216,3 @@ function buildTree(arr: number[], left: number, right: number): TreeNode | null -

- - - diff --git "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" index e3db794706..e9ea5f4463 100644 --- "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" +++ "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1791.找出星型图的中心节点 @@ -77,7 +75,3 @@ public: ``` -

- - - diff --git "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" index 93e9b66365..acb544155a 100644 --- "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" +++ "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 1971. 寻找图中是否存在路径 @@ -335,7 +333,3 @@ func validPath(n int, edges [][]int, source int, destination int) bool { ``` -

- - - diff --git "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" index a5dab942c8..7276af53b3 100644 --- "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" +++ "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 程序提交之后为什么会超时?O(n)的算法会超时,n究竟是多大? @@ -224,7 +222,3 @@ int main() { -

- - - diff --git "a/problems/images/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231-03.png" "b/problems/images/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231-03.png" new file mode 100644 index 0000000000000000000000000000000000000000..7ad2ced6903b82f6c6db2d8d85746df9097fc01a GIT binary patch literal 56769 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参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

' -cx $i - ex -sc '1i|' -cx $i - ex -sc '1i| ' -cx $i - ex -sc '1i|' -cx $i - ex -sc '1i|

' -cx $i + # ex -sc '1i|

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

' -cx $i + # ex -sc '1i|' -cx $i + # ex -sc '1i| ' -cx $i + # ex -sc '1i|' -cx $i + # ex -sc '1i|

' -cx $i + + ex -sc '1i|* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html)' -cx $i + ex -sc '1i|* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html)' -cx $i + ex -sc '1i|* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html)' -cx $i + + # echo '## 其他语言版本' >> $i # echo '\n' >> $i # echo 'Java:' >> $i @@ -48,10 +54,10 @@ do # 添加结尾 - echo '

' >> $i - echo '' >> $i - echo ' ' >> $i - echo '' >> $i + # echo '

' >> $i + # echo '' >> $i + # echo ' ' >> $i + # echo '' >> $i # echo '-----------------------' >> $i diff --git "a/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" "b/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" index c2f5efd96d..69d6aa9c45 100644 --- "a/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" +++ "b/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 动态规划之编辑距离总结篇 @@ -196,7 +194,3 @@ class Solution { -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" "b/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" index 42d78ae39f..7fa2b6ec94 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 二叉树:以为使用了递归,其实还隐藏着回溯 @@ -687,7 +685,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" index 4794233ab5..f4d093d638 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 二叉树:总结篇!(需要掌握的二叉树技能都在这里了) @@ -158,8 +156,4 @@ -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" index c665827791..9a63b66cfd 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -314,7 +312,3 @@ public class TreeNode } ``` -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" index a6d4e3ffc3..d001e0f7a7 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 统一写法是一种什么感觉 @@ -970,8 +968,4 @@ public IList PostorderTraversal(TreeNode root) ``` -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" index a3c5b38fa0..289c651b60 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 听说还可以用非递归的方式 @@ -797,7 +795,3 @@ public IList PostorderTraversal(TreeNode root) } ``` -

- - - diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" index 8f61b8c69a..ffa3ff6cf8 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 一看就会,一写就废! @@ -728,7 +726,3 @@ function traversal($root, array &$output) { ``` -

- - - diff --git "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" index f5803cb452..fd2d16f47a 100644 --- "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" +++ "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 替换数字 @@ -171,7 +169,3 @@ for (int i = 0; i < a.size(); i++) { -

- - - diff --git "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" index e32f4ce15d..6fe12e3d51 100644 --- "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 右旋字符串 @@ -176,7 +174,3 @@ int main() { -

- - - diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" index 7927deb7d7..314fb471b1 100644 --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # Leetcode股票问题总结篇! @@ -474,7 +472,3 @@ public: -

- - - diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" index dd1646d6d8..faca5ecb55 100644 --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 动态规划最强总结篇! @@ -132,7 +130,3 @@ 所以Carl花费的这么大精力,把自己对动规算法理解 一五一十的全部分享给了录友们,帮助大家少走弯路,加油! -

- - - diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" index 9ffb453377..634f710f9a 100644 --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 动态规划理论基础 @@ -132,7 +130,3 @@ -

- - - diff --git "a/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" "b/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" index 409e80ab98..9c92e3d6c3 100644 --- "a/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" +++ "b/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 又是一波总结 @@ -95,7 +93,3 @@ for (int i = 0; i < array.size(); i++) { 建议大家可以把文中涉及到的题目在好好做一做,琢磨琢磨,基本对双指针法就不在话下了。 -

- - - diff --git "a/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" "b/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" index cde23ad138..55caffe4f0 100644 --- "a/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" +++ "b/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 哈希表总结篇如约而至 @@ -126,7 +124,3 @@ std::unordered_map 底层实现为哈希,std::map 和std::multimap 的底层 -

- - - diff --git "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" index 825c465719..b7d10671e1 100644 --- "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -132,7 +130,3 @@ std::unordered_map 底层实现为哈希表,std::map 和std::multimap 的底 -

- - - diff --git "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" index 8d9b78c4b9..b8d96193ee 100644 --- "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" +++ "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -448,7 +446,3 @@ N皇后问题分析: -

- - - diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" index 96dfeffec3..f1e1570a61 100644 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 回溯算法去重问题的另一种写法 @@ -709,7 +707,3 @@ impl Solution { ``` -

- - - diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" index 862fb101a1..474fb8f749 100644 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 回溯算法理论基础 @@ -176,7 +174,3 @@ void backtracking(参数) { -

- - - diff --git "a/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" "b/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" index 7da9791400..460944c5d2 100644 --- "a/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" +++ "b/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 字符串:总结篇 @@ -124,7 +122,3 @@ KMP算法是字符串查找最重要的算法,但彻底理解KMP并不容易 -

- - - diff --git "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" index 7c2fd94724..e45165a625 100644 --- "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 数组总结篇 @@ -135,7 +133,3 @@ 推荐的题目即使大家之前做过了,再读一遍文章,也会帮助你提炼出解题的精髓所在。 -

- - - diff --git "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" index e6d25c15e6..c1ac287d0f 100644 --- "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -119,7 +117,3 @@ public static void test_arr() { -

- - - diff --git "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" index df022c779b..2d09daeb94 100644 --- "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" +++ "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 栈与队列总结篇 @@ -160,7 +158,3 @@ cd a/b/c/../../ -

- - - diff --git "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" index 21c61a4c8b..bff0ec634b 100644 --- "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) > 来看看栈和队列不为人知的一面 @@ -93,7 +91,3 @@ std::queue> third; // 定义以list为底层容器的队列 -

- - - diff --git "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" index 70a9a97a19..a2350835d6 100644 --- "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" +++ "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -209,7 +207,3 @@ Go中slice的`append`操作和C++中vector的扩容机制基本相同。 -

- - - diff --git "a/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" "b/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" index 0d32cebb2d..068806d622 100644 --- "a/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" +++ "b/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 算法模板 ## 算法模板 @@ -853,7 +851,3 @@ Go: -

- - - diff --git "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" index 651a92a804..3c587b6d2e 100644 --- "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 听说背包问题很难? 这篇总结篇来拯救你了 @@ -103,7 +101,3 @@ -

- - - diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" index d9b953c0b3..c2598ec99a 100644 --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -593,7 +591,3 @@ int main() { -

- - - diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" index b5862bb52b..6caa4f6327 100644 --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 动态规划:01背包理论基础(滚动数组) @@ -461,7 +459,3 @@ int main() { ``` -

- - - diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" index a8e241c3ba..5a23b67c73 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" @@ -1,3 +1,6 @@ +* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 完全背包-一维数组 diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" index 878efc1297..39e7ebe378 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 动态规划:关于多重背包,你该了解这些! @@ -237,7 +235,3 @@ print(dp[-1]) -

- - - diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" index ea658f7e51..d76ff196b1 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 完全背包理论基础-二维DP数组 @@ -362,7 +360,3 @@ readline.on('close', () => { ``` -

- - - diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" index 14d82151c9..7d4c57e877 100644 --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 贪心算法总结篇 @@ -151,7 +149,3 @@ Carl个人认为:如果找出局部最优并可以推出全局最优,就是 -

- - - diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" index 6fde2dbbe6..14f397296f 100644 --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 关于贪心算法,你该了解这些! @@ -92,7 +90,3 @@ 最后给出贪心的一般解题步骤,大家可以发现这个解题步骤也是比较抽象的,不像是二叉树,回溯算法,给出了那么具体的解题套路和模板。 -

- - - diff --git "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" index 7da0d2de3c..e29ba268a3 100644 --- "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 链表总结篇 @@ -98,7 +96,3 @@ -

- - - diff --git "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" index d131380728..3637d05f5a 100644 --- "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) @@ -275,7 +273,3 @@ public class Node -

- - - diff --git "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" index 48944b5e4e..f8d9039a48 100644 --- "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" +++ "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" @@ -1,8 +1,6 @@ -

- - - -

参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们受益!

+* [做项目(多个C++、Java、Go、测开、前端项目)](https://www.programmercarl.com/other/kstar.html) +* [刷算法(两个月高强度学算法)](https://www.programmercarl.com/xunlian/xunlianying.html) +* [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) # 面试题 02.07. 链表相交 @@ -575,7 +573,3 @@ func getIntersectionNode(_ headA: ListNode?, _ headB: ListNode?) -> ListNode? { ``` -

- - - From 18ba181db38a7b619062df6122c7081bf9d7af79 Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Sun, 16 Mar 2025 17:28:55 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E8=BE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" | 2 -- "problems/0042.\346\216\245\351\233\250\346\260\264.md" | 1 - 2 files changed, 3 deletions(-) diff --git "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" index 281db4dc86..4a9d59cc23 100644 --- "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" +++ "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" @@ -3,8 +3,6 @@ * [背八股(40天挑战高频面试题)](https://www.programmercarl.com/xunlian/bagu.html) -> 这篇可以说是全网把组合问题如何去重,讲的最清晰的了! - # 40.组合总和II [力扣题目链接](https://leetcode.cn/problems/combination-sum-ii/) diff --git "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" index 8a424e3ea2..8c43ae6051 100644 --- "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" +++ "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" @@ -5,7 +5,6 @@ -> 这个图就是大厂面试经典题目,接雨水! 最常青藤的一道题,面试官百出不厌! # 42. 接雨水 From 73a3cb532fd01f0abacb317b084630d46c640446 Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Mon, 17 Mar 2025 10:57:51 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- ...\227\347\254\246\344\270\262\346\216\245\351\276\231.md" | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index acd07c28d0..2d40e2b99d 100644 --- a/README.md +++ b/README.md @@ -385,8 +385,8 @@ 8. [图论:孤岛的总面积](./problems/kamacoder/0101.孤岛的总面积.md) 9. [图论:沉没孤岛](./problems/kamacoder/0102.沉没孤岛.md) 10. [图论:水流问题](./problems/kamacoder/0103.水流问题.md) -11. [图论:岛屿的周长](./problems/kamacoder/0106.岛屿的周长.md) -12. [图论:建造最大岛屿](./problems/kamacoder/0104.建造最大岛屿.md) +11. [图论:建造最大岛屿](./problems/kamacoder/0104.建造最大岛屿.md) +12. [图论:岛屿的周长](./problems/kamacoder/0106.岛屿的周长.md) 13. [图论:字符串接龙](./problems/kamacoder/0110.字符串接龙.md) 14. [图论:有向图的完全可达性](./problems/kamacoder/0105.有向图的完全可达性.md) 15. [图论:并查集理论基础](./problems/kamacoder/图论并查集理论基础.md) diff --git "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" index f6d97866da..8bae6280bf 100644 --- "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" +++ "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" @@ -57,11 +57,7 @@ yhn 2 <= N <= 500

-<<<<<<< HEAD - -======= - ->>>>>>> d0bd2dc5 (更新图) +

From 91e7dab72c2053502928607738575d9b1002ad7f Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Mon, 17 Mar 2025 11:18:46 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A1=A8=E8=BE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" | 2 -- 1 file changed, 2 deletions(-) diff --git "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" index 0e13846d60..eb80e048f6 100644 --- "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" +++ "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" @@ -387,8 +387,6 @@ int main() { * 本题可以有负权回路,说明只要多做松弛,结果是会变的。 * 本题要求最多经过k个节点,对松弛次数是有限制的。 -如果本题中 没有负权回路的测试用例, 那版本一的代码就可以过了,也就不用我费这么大口舌去讲解的这个坑了。 - ## 拓展三(SPFA) 本题也可以用 SPFA来做,关于 SPFA ,已经在这里 [0094.城市间货物运输I-SPFA](./0094.城市间货物运输I-SPFA.md) 有详细讲解。 From 86a0208485d7379a4e4f0e4dda4545eec34ac9da Mon Sep 17 00:00:00 2001 From: programmercarl <826123027@qq.com> Date: Mon, 17 Mar 2025 15:52:23 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++-- ...44\346\225\260\344\271\213\345\222\214.md" | 4 +- ...36\346\226\207\345\255\220\344\270\262.md" | 4 +- ...27\346\257\215\347\273\204\345\220\210.md" | 4 +- ...4N\344\270\252\350\212\202\347\202\271.md" | 2 +- ...10\347\232\204\346\213\254\345\217\267.md" | 6 +-- ...22\345\205\245\344\275\215\347\275\256.md" | 10 ++-- ...7.\350\247\243\346\225\260\347\213\254.md" | 8 ++-- ...04\345\220\210\346\200\273\345\222\214.md" | 8 ++-- ...\345\220\210\346\200\273\345\222\214II.md" | 6 +-- ...2.\346\216\245\351\233\250\346\260\264.md" | 14 +++--- ...\350\267\203\346\270\270\346\210\217II.md" | 6 +-- ...6.\345\205\250\346\216\222\345\210\227.md" | 6 +-- ...\345\205\250\346\216\222\345\210\227II.md" | 6 +-- "problems/0051.N\347\232\207\345\220\216.md" | 6 +-- .../0052.N\347\232\207\345\220\216II.md" | 2 +- ...01\350\247\204\345\210\222\357\274\211.md" | 2 +- ...72\346\227\213\347\237\251\351\230\265.md" | 2 +- ...63\350\267\203\346\270\270\346\210\217.md" | 2 +- ...10\345\271\266\345\214\272\351\227\264.md" | 2 +- ...\346\227\213\347\237\251\351\230\265II.md" | 2 +- ...15\345\220\214\350\267\257\345\276\204.md" | 10 ++-- ...\345\220\214\350\267\257\345\276\204II.md" | 12 ++--- ...0.\347\210\254\346\245\274\346\242\257.md" | 2 +- ...26\350\276\221\350\267\235\347\246\273.md" | 4 +- "problems/0077.\347\273\204\345\220\210.md" | 10 ++-- ...04\345\220\210\344\274\230\345\214\226.md" | 2 +- ...47\347\232\204\347\237\251\345\275\242.md" | 10 ++-- "problems/0090.\345\255\220\351\233\206II.md" | 2 +- ...\345\216\237IP\345\234\260\345\235\200.md" | 4 +- ...11\346\220\234\347\264\242\346\240\221.md" | 10 ++-- ...11\346\220\234\347\264\242\346\240\221.md" | 4 +- ...70\345\220\214\347\232\204\346\240\221.md" | 4 +- ...60\344\272\214\345\217\211\346\240\221.md" | 4 +- ...02\345\272\217\351\201\215\345\216\206.md" | 18 +++---- ...00\345\244\247\346\267\261\345\272\246.md" | 6 +-- ...40\344\272\214\345\217\211\346\240\221.md" | 8 ++-- ...11\346\220\234\347\264\242\346\240\221.md" | 4 +- ...41\344\272\214\345\217\211\346\240\221.md" | 6 +-- ...00\345\260\217\346\267\261\345\272\246.md" | 2 +- ...57\345\276\204\346\200\273\345\222\214.md" | 8 ++-- ...04\345\255\220\345\272\217\345\210\227.md" | 4 +- ...02\347\202\271\346\214\207\351\222\210.md" | 2 +- ...00\344\275\263\346\227\266\346\234\272.md" | 2 +- ...\344\275\263\346\227\266\346\234\272II.md" | 2 +- ...344\275\263\346\227\266\346\234\272III.md" | 2 +- ...25\350\257\215\346\216\245\351\276\231.md" | 2 +- ...25\347\232\204\345\214\272\345\237\237.md" | 6 +-- ...\345\233\236\346\226\207\344\270\262II.md" | 2 +- ...4.\345\212\240\346\262\271\347\253\231.md" | 4 +- ...06\345\217\221\347\263\226\346\236\234.md" | 6 +-- ...25\350\257\215\346\213\206\345\210\206.md" | 4 +- ...57\345\275\242\351\223\276\350\241\250.md" | 2 +- ...\345\275\242\351\223\276\350\241\250II.md" | 12 ++--- ...15\346\216\222\351\223\276\350\241\250.md" | 2 +- ...\344\275\263\346\227\266\346\234\272IV.md" | 2 +- ...23\345\256\266\345\212\253\350\210\215.md" | 2 +- ...7.\345\271\277\346\220\234\347\211\210.md" | 6 +-- ...7.\346\267\261\346\220\234\347\211\210.md" | 4 +- ...76\350\241\250\345\205\203\347\264\240.md" | 12 ++--- ...73\350\275\254\351\223\276\350\241\250.md" | 2 +- ...04\345\255\220\346\225\260\347\273\204.md" | 2 +- ...\345\256\266\345\212\253\350\210\215II.md" | 6 +-- ...345\220\210\346\200\273\345\222\214III.md" | 6 +-- ...02\347\202\271\344\270\252\346\225\260.md" | 12 ++--- ...54\344\272\214\345\217\211\346\240\221.md" | 4 +- ...54\345\205\261\347\245\226\345\205\210.md" | 6 +-- ...54\345\205\261\347\245\226\345\205\210.md" | 12 ++--- ...00\346\234\211\350\267\257\345\276\204.md" | 6 +-- ...50\345\271\263\346\226\271\346\225\260.md" | 2 +- ...07\345\255\220\345\272\217\345\210\227.md" | 2 +- ...53\345\206\267\345\206\273\346\234\237.md" | 4 +- ...66\351\222\261\345\205\221\346\215\242.md" | 2 +- ...11\346\216\222\350\241\214\347\250\213.md" | 6 +-- ...345\256\266\345\212\253\350\210\215III.md" | 4 +- ...64\346\225\260\346\213\206\345\210\206.md" | 2 +- ...04\347\232\204\344\272\244\351\233\206.md" | 4 +- ...06\345\212\250\345\272\217\345\210\227.md" | 12 ++--- ...10\346\200\273\345\222\214\342\205\243.md" | 2 +- ...55\345\255\220\345\272\217\345\210\227.md" | 6 +-- ...66\345\255\220\344\271\213\345\222\214.md" | 6 +-- ...15\345\273\272\351\230\237\345\210\227.md" | 2 +- ...11\345\222\214\345\255\220\351\233\206.md" | 2 +- ...64\346\265\201\351\227\256\351\242\230.md" | 6 +-- ...15\345\217\240\345\214\272\351\227\264.md" | 2 +- ...55\347\232\204\350\212\202\347\202\271.md" | 2 +- ...25\347\210\206\346\260\224\347\220\203.md" | 2 +- ...06\345\217\221\351\245\274\345\271\262.md" | 4 +- ...20\345\255\227\347\254\246\344\270\262.md" | 30 ++++++------ ...77\347\232\204\345\221\250\351\225\277.md" | 2 +- ...4.\344\270\200\345\222\214\351\233\266.md" | 4 +- ...36\345\255\220\345\272\217\345\210\227.md" | 4 +- ...4.\347\233\256\346\240\207\345\222\214.md" | 30 ++++++------ ...55\347\232\204\344\274\227\346\225\260.md" | 4 +- ...13\350\247\222\347\232\204\345\200\274.md" | 4 +- ...07\345\255\220\345\272\217\345\210\227.md" | 8 ++-- ...\351\222\261\345\205\221\346\215\242II.md" | 4 +- ...17\347\273\235\345\257\271\345\267\256.md" | 4 +- ...72\347\264\257\345\212\240\346\240\221.md" | 4 +- ...40\351\231\244\346\223\215\344\275\234.md" | 2 +- ...66\344\272\214\345\217\211\346\240\221.md" | 2 +- ...36\346\226\207\345\255\220\344\270\262.md" | 6 +-- ...47\344\272\214\345\217\211\346\240\221.md" | 2 +- ...11\346\220\234\347\264\242\346\240\221.md" | 10 ++-- ...27\347\232\204\344\270\252\346\225\260.md" | 2 +- ...22\345\242\236\345\272\217\345\210\227.md" | 2 +- ...27\344\275\231\350\277\236\346\216\245.md" | 6 +-- ...\344\275\231\350\277\236\346\216\245II.md" | 4 +- ...00\345\244\247\351\235\242\347\247\257.md" | 4 +- ...55\347\232\204\346\220\234\347\264\242.md" | 4 +- ...22\345\205\245\346\223\215\344\275\234.md" | 2 +- ...14\345\210\206\346\237\245\346\211\276.md" | 4 +- ...76\350\256\241\351\223\276\350\241\250.md" | 6 +-- ...15\345\255\220\346\225\260\347\273\204.md" | 4 +- ...17\346\227\245\346\270\251\345\272\246.md" | 24 +++++----- ...66\350\277\237\346\227\266\351\227\264.md" | 46 +++++++++--------- ...71\347\210\254\346\245\274\346\242\257.md" | 4 +- ...27\346\257\215\345\214\272\351\227\264.md" | 2 +- ...34\347\232\204\350\210\252\347\217\255.md" | 6 +-- ...75\347\232\204\350\267\257\345\276\204.md" | 4 +- ...47\344\272\272\345\267\245\345\262\233.md" | 6 +-- ...31\345\222\214\346\210\277\351\227\264.md" | 4 +- ...61\350\204\211\346\225\260\347\273\204.md" | 2 +- ...47\344\272\214\345\217\211\346\240\221.md" | 10 ++-- ...60\347\232\204\346\225\260\351\207\217.md" | 8 ++-- ...70\344\272\244\347\232\204\347\272\277.md" | 4 +- ...\347\232\204\351\207\215\351\207\217II.md" | 2 +- ...61\345\255\220\345\272\217\345\210\227.md" | 4 +- ...77\347\232\204\346\225\260\347\233\256.md" | 4 +- ...21\345\217\230\345\271\263\350\241\241.md" | 2 +- ...55\345\277\203\350\212\202\347\202\271.md" | 2 +- ...30\345\234\250\350\267\257\345\276\204.md" | 2 +- ...57\345\244\232\345\244\247\357\274\237.md" | 10 ++-- ...17\202\344\274\232dijkstra\345\240\206.md" | 14 +++--- ...74\232dijkstra\346\234\264\347\264\240.md" | 40 ++++++++-------- .../0053.\345\257\273\345\256\235-Kruskal.md" | 20 ++++---- .../0053.\345\257\273\345\256\235-prim.md" | 22 ++++----- ...77\346\215\242\346\225\260\345\255\227.md" | 4 +- ...13\345\255\227\347\254\246\344\270\262.md" | 8 ++-- ...8.\345\214\272\351\227\264\345\222\214.md" | 4 +- ...\211\251\350\277\220\350\276\223I-SPFA.md" | 20 ++++---- ...7\347\211\251\350\277\220\350\276\223I.md" | 20 ++++---- ...\347\211\251\350\277\220\350\276\223II.md" | 4 +- ...347\211\251\350\277\220\350\276\223III.md" | 40 ++++++++-------- ...16\351\200\233\345\205\254\345\233\255.md" | 12 ++--- ...57\350\276\276\350\267\257\345\276\204.md" | 4 +- ...60\351\207\217\345\271\277\346\220\234.md" | 6 +-- ...60\351\207\217\346\267\261\346\220\234.md" | 4 +- ...00\345\244\247\351\235\242\347\247\257.md" | 4 +- ...04\346\200\273\351\235\242\347\247\257.md" | 6 +-- ...11\346\262\241\345\255\244\345\262\233.md" | 6 +-- ...64\346\265\201\351\227\256\351\242\230.md" | 6 +-- ...00\345\244\247\345\262\233\345\261\277.md" | 10 ++-- ...50\345\217\257\350\276\276\346\200\247.md" | 4 +- ...77\347\232\204\345\221\250\351\225\277.md" | 8 ++-- ...50\347\232\204\350\267\257\345\276\204.md" | 2 +- ...27\344\275\231\350\277\236\346\216\245.md" | 12 ++--- ...\344\275\231\350\277\236\346\216\245II.md" | 12 ++--- ...46\344\270\262\346\216\245\351\276\231.md" | 4 +- ...57\344\273\266\346\236\204\345\273\272.md" | 22 ++++----- ...7\232\204\346\224\273\345\207\273astar.md" | 8 ++-- ...06\350\256\272\345\237\272\347\241\200.md" | 24 +++++----- ...06\350\256\272\345\237\272\347\241\200.md" | 6 +-- ...06\350\256\272\345\237\272\347\241\200.md" | 14 +++--- ...06\350\256\272\345\237\272\347\241\200.md" | 30 ++++++------ ...30\346\200\273\347\273\223\347\257\207.md" | 2 +- problems/qita/acm.md | 20 ++++---- problems/qita/join.md | 48 +++++++++---------- problems/qita/server.md | 6 +-- problems/qita/shejimoshi.md | 14 +++--- problems/qita/tulunfabu.md | 34 ++++++------- ...21\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 16 +++---- ...55\344\273\243\351\201\215\345\216\206.md" | 2 +- .../ACM\346\250\241\345\274\217.md" | 18 +++---- ...72\344\272\214\345\217\211\346\240\221.md" | 16 +++---- "problems/\345\211\215\345\272\217/vim.md" | 2 +- ...43\347\240\201\351\243\216\346\240\274.md" | 2 +- ...05\345\255\230\346\266\210\350\200\227.md" | 8 ++-- ...64\345\244\215\346\235\202\345\272\246.md" | 6 +-- ...17\345\221\230\347\256\200\345\216\206.md" | 4 +- ...27\346\263\225\350\266\205\346\227\266.md" | 10 ++-- ...02\345\272\246\345\210\206\346\236\220.md" | 6 +-- ...64\345\244\215\346\235\202\345\272\246.md" | 4 +- ...77\346\215\242\347\251\272\346\240\274.md" | 4 +- ...54\345\255\227\347\254\246\344\270\262.md" | 8 ++-- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 10 ++-- ...50\346\234\253\346\200\273\347\273\223.md" | 12 ++--- ...50\346\234\253\346\200\273\347\273\223.md" | 10 ++-- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 4 +- ...50\346\234\253\346\200\273\347\273\223.md" | 8 ++-- ...50\346\234\253\346\200\273\347\273\223.md" | 12 ++--- ...50\346\234\253\346\200\273\347\273\223.md" | 6 +-- ...50\346\234\253\346\200\273\347\273\223.md" | 4 +- ...50\346\234\253\346\200\273\347\273\223.md" | 10 ++-- ...50\346\234\253\346\200\273\347\273\223.md" | 6 +-- ...06\350\256\272\345\237\272\347\241\200.md" | 12 ++--- ...36\346\272\257\346\200\273\347\273\223.md" | 42 ++++++++-------- ...00\347\247\215\345\206\231\346\263\225.md" | 4 +- ...06\350\256\272\345\237\272\347\241\200.md" | 4 +- ...04\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 6 +-- ...06\350\256\272\345\237\272\347\241\200.md" | 6 +-- ...06\350\256\262\350\247\243\357\274\211.md" | 8 ++-- ...05\346\200\273\347\273\223\347\257\207.md" | 4 +- ...47\241\20001\350\203\214\345\214\205-1.md" | 26 +++++----- ...47\241\20001\350\203\214\345\214\205-2.md" | 2 +- ...14\345\214\205\344\270\200\347\273\264.md" | 4 +- ...14\345\205\250\350\203\214\345\214\205.md" | 10 ++-- ...25\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 2 +- ...50\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 14 +++--- ...76\350\241\250\347\233\270\344\272\244.md" | 8 ++-- 216 files changed, 813 insertions(+), 813 deletions(-) diff --git a/README.md b/README.md index 2d40e2b99d..06de2f5d0e 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ 题目分类大纲如下: -二叉树大纲 +二叉树大纲 1. [关于二叉树,你该了解这些!](./problems/二叉树理论基础.md) 2. [二叉树:二叉树的递归遍历](./problems/二叉树的递归遍历.md) @@ -222,7 +222,7 @@ 题目分类大纲如下: -回溯算法大纲 +回溯算法大纲 1. [关于回溯算法,你该了解这些!](./problems/回溯算法理论基础.md) 2. [回溯算法:77.组合](./problems/0077.组合.md) @@ -252,7 +252,7 @@ 题目分类大纲如下: -贪心算法大纲 +贪心算法大纲 1. [关于贪心算法,你该了解这些!](./problems/贪心算法理论基础.md) 2. [贪心算法:455.分发饼干](./problems/0455.分发饼干.md) @@ -503,5 +503,5 @@ 添加微信记得备注,如果是已工作,备注:姓名-城市-岗位。如果学生,备注:姓名-学校-年级。**备注没有自我介绍不通过哦** -
+
diff --git "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" index 6be92fa81b..f9bea8289e 100644 --- "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" @@ -83,10 +83,10 @@ map目的用来存放我们访问过的元素,因为遍历数组的时候, 过程如下: -![过程一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220711202638.png) +![过程一](https://file.kamacoder.com/pics/20220711202638.png) -![过程二](https://code-thinking-1253855093.file.myqcloud.com/pics/20230220223536.png) +![过程二](https://file.kamacoder.com/pics/20230220223536.png) C++代码: diff --git "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" index 4ce49810b3..1e0667e575 100644 --- "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -106,7 +106,7 @@ dp[i][j]可以初始化为true么? 当然不行,怎能刚开始就全都匹 dp[i + 1][j - 1] 在 dp[i][j]的左下角,如图: -![647.回文子串](https://code-thinking-1253855093.file.myqcloud.com/pics/20210121171032473.jpg) +![647.回文子串](https://file.kamacoder.com/pics/20210121171032473.jpg) 如果这矩阵是从上到下,从左到右遍历,那么会用到没有计算过的dp[i + 1][j - 1],也就是根据不确定是不是回文的区间[i+1,j-1],来判断了[i,j]是不是回文,那结果一定是不对的。 @@ -140,7 +140,7 @@ for (int i = s.size() - 1; i >= 0; i--) { // 注意遍历顺序 举例,输入:"aaa",dp[i][j]状态如下: -![647.回文子串1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210121171059951.jpg) +![647.回文子串1](https://file.kamacoder.com/pics/20210121171059951.jpg) **注意因为dp[i][j]的定义,所以j一定是大于等于i的,那么在填充dp[i][j]的时候一定是只填充右上半部分**。 diff --git "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" index 93f41e0f74..a35fd4e2bc 100644 --- "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" +++ "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" @@ -11,7 +11,7 @@ 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 -![17.电话号码的字母组合](https://code-thinking-1253855093.file.myqcloud.com/pics/2020102916424043.png) +![17.电话号码的字母组合](https://file.kamacoder.com/pics/2020102916424043.png) 示例: * 输入:"23" @@ -64,7 +64,7 @@ const string letterMap[10] = { 例如:输入:"23",抽象为树形结构,如图所示: -![17. 电话号码的字母组合](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123200304469.png) +![17. 电话号码的字母组合](https://file.kamacoder.com/pics/20201123200304469.png) 图中可以看出遍历的深度,就是输入"23"的长度,而叶子节点就是我们要收集的结果,输出["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]。 diff --git "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" index 53b59039e5..9b2ba88ef8 100644 --- "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" +++ "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" @@ -16,7 +16,7 @@ 示例 1: -![19.删除链表的倒数第N个节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20210510085957392.png) +![19.删除链表的倒数第N个节点](https://file.kamacoder.com/pics/20210510085957392.png) 输入:head = [1,2,3,4,5], n = 2 输出:[1,2,3,5] diff --git "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" index c642fb4ecd..7282471285 100644 --- "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" +++ "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" @@ -81,13 +81,13 @@ cd a/b/c/../../ 1. 第一种情况,字符串里左方向的括号多余了 ,所以不匹配。 -![括号匹配1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020080915505387.png) +![括号匹配1](https://file.kamacoder.com/pics/2020080915505387.png) 2. 第二种情况,括号没有多余,但是 括号的类型没有匹配上。 -![括号匹配2](https://code-thinking-1253855093.file.myqcloud.com/pics/20200809155107397.png) +![括号匹配2](https://file.kamacoder.com/pics/20200809155107397.png) 3. 第三种情况,字符串里右方向的括号多余了,所以不匹配。 -![括号匹配3](https://code-thinking-1253855093.file.myqcloud.com/pics/20200809155115779.png) +![括号匹配3](https://file.kamacoder.com/pics/20200809155115779.png) diff --git "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" index e0b065cd5a..c9826fa205 100644 --- "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" +++ "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" @@ -41,7 +41,7 @@ 这道题目,要在数组中插入目标值,无非是这四种情况。 -![35_搜索插入位置3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201216232148471.png) +![35_搜索插入位置3](https://file.kamacoder.com/pics/20201216232148471.png) * 目标值在数组所有元素之前 * 目标值等于数组中某一个元素 @@ -82,14 +82,14 @@ public: 效率如下: -![35_搜索插入位置](https://code-thinking-1253855093.file.myqcloud.com/pics/20201216232127268.png) +![35_搜索插入位置](https://file.kamacoder.com/pics/20201216232127268.png) ### 二分法 既然暴力解法的时间复杂度是O(n),就要尝试一下使用二分查找法。 -![35_搜索插入位置4](https://code-thinking-1253855093.file.myqcloud.com/pics/202012162326354.png) +![35_搜索插入位置4](https://file.kamacoder.com/pics/202012162326354.png) 大家注意这道题目的前提是数组是有序数组,这也是使用二分查找的基础条件。 @@ -99,7 +99,7 @@ public: 大体讲解一下二分法的思路,这里来举一个例子,例如在这个数组中,使用二分法寻找元素为5的位置,并返回其下标。 -![35_搜索插入位置5](https://code-thinking-1253855093.file.myqcloud.com/pics/20201216232659199.png) +![35_搜索插入位置5](https://file.kamacoder.com/pics/20201216232659199.png) 二分查找涉及的很多的边界条件,逻辑比较简单,就是写不好。 @@ -150,7 +150,7 @@ public: * 空间复杂度:O(1) 效率如下: -![35_搜索插入位置2](https://code-thinking-1253855093.file.myqcloud.com/pics/2020121623272877.png) +![35_搜索插入位置2](https://file.kamacoder.com/pics/2020121623272877.png) ### 二分法第二种写法 diff --git "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" index b26bf53308..5d2adb4d9d 100644 --- "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" +++ "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" @@ -18,11 +18,11 @@ 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。 空白格用 '.' 表示。 -![解数独](https://code-thinking-1253855093.file.myqcloud.com/pics/202011171912586.png) +![解数独](https://file.kamacoder.com/pics/202011171912586.png) 一个数独。 -![解数独](https://code-thinking-1253855093.file.myqcloud.com/pics/20201117191340669.png) +![解数独](https://file.kamacoder.com/pics/20201117191340669.png) 答案被标成红色。 @@ -52,7 +52,7 @@ 因为这个树形结构太大了,我抽取一部分,如图所示: -![37.解数独](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111720451790-20230310131816104.png) +![37.解数独](https://file.kamacoder.com/pics/2020111720451790-20230310131816104.png) ### 回溯三部曲 @@ -83,7 +83,7 @@ bool backtracking(vector>& board) * 递归单层搜索逻辑 -![37.解数独](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111720451790-20230310131822254.png) +![37.解数独](https://file.kamacoder.com/pics/2020111720451790-20230310131822254.png) 在树形图中可以看出我们需要的是一个二维的递归 (一行一列) diff --git "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" index 455bd697cd..8467277115 100644 --- "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" +++ "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" @@ -50,7 +50,7 @@ candidates 中的数字可以无限制重复被选取。 本题搜索的过程抽象成树形结构如下: -![39.组合总和](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170730367.png) +![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) 注意图中叶子节点的返回条件,因为本题没有组合数量要求,仅仅是总和的限制,所以递归没有层数的限制,只要选取的元素总和超过target,就返回! 而在[77.组合](https://programmercarl.com/0077.组合.html)和[216.组合总和III](https://programmercarl.com/0216.组合总和III.html) 中都可以知道要递归K层,因为要取k个元素的组合。 @@ -85,7 +85,7 @@ void backtracking(vector& candidates, int target, int sum, int startIndex) 在如下树形结构中: -![39.组合总和](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170730367-20230310135337214.png) +![39.组合总和](https://file.kamacoder.com/pics/20201223170730367-20230310135337214.png) 从叶子节点可以清晰看到,终止只有两种情况,sum大于target和sum等于target。 @@ -158,7 +158,7 @@ public: 在这个树形结构中: -![39.组合总和](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170730367-20230310135342472.png) +![39.组合总和](https://file.kamacoder.com/pics/20201223170730367-20230310135342472.png) 以及上面的版本一的代码大家可以看到,对于sum已经大于target的情况,其实是依然进入了下一层递归,只是下一层递归结束判断的时候,会判断sum > target的话就返回。 @@ -171,7 +171,7 @@ public: 如图: -![39.组合总和1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170809182.png) +![39.组合总和1](https://file.kamacoder.com/pics/20201223170809182.png) for循环剪枝代码如下: diff --git "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" index 4a9d59cc23..f0cbc2200f 100644 --- "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" +++ "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" @@ -76,7 +76,7 @@ candidates 中的每个数字在每个组合中只能使用一次。 选择过程树形结构如图所示: -![40.组合总和II](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000918.png) +![40.组合总和II](https://file.kamacoder.com/pics/20230310000918.png) 可以看到图中,每个节点相对于 [39.组合总和](https://mp.weixin.qq.com/s/FLg8G6EjVcxBjwCbzpACPw)我多加了used数组,这个used数组下面会重点介绍。 @@ -126,7 +126,7 @@ if (sum == target) { 这块比较抽象,如图: -![40.组合总和II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000954.png) +![40.组合总和II1](https://file.kamacoder.com/pics/20230310000954.png) 我在图中将used的变化用橘黄色标注上,可以看出在candidates[i] == candidates[i - 1]相同的情况下: @@ -137,7 +137,7 @@ if (sum == target) { 而 used[i - 1] == true,说明是进入下一层递归,去下一个数,所以是树枝上,如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221021163812.png) +![](https://file.kamacoder.com/pics/20221021163812.png) **这块去重的逻辑很抽象,网上搜的题解基本没有能讲清楚的,如果大家之前思考过这个问题或者刷过这道题目,看到这里一定会感觉通透了很多!** diff --git "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" index 8c43ae6051..1e6ec11bc5 100644 --- "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" +++ "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" @@ -47,10 +47,10 @@ 首先要明确,要按照行来计算,还是按照列来计算。 按照行来计算如图: -![42.接雨水2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210402091118927.png) +![42.接雨水2](https://file.kamacoder.com/pics/20210402091118927.png) 按照列来计算如图: -![42.接雨水1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210402091208445.png) +![42.接雨水1](https://file.kamacoder.com/pics/20210402091208445.png) 一些同学在实现的时候,很容易一会按照行来计算一会按照列来计算,这样就会越写越乱。 @@ -62,7 +62,7 @@ 这句话可以有点绕,来举一个理解,例如求列4的雨水高度,如图: -![42.接雨水3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210223092732301.png) +![42.接雨水3](https://file.kamacoder.com/pics/20210223092732301.png) 列4 左侧最高的柱子是列3,高度为2(以下用lHeight表示)。 @@ -201,7 +201,7 @@ public: 1. 首先单调栈是按照行方向来计算雨水,如图: -![42.接雨水2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210223092629946.png) +![42.接雨水2](https://file.kamacoder.com/pics/20210223092629946.png) 知道这一点,后面的就可以理解了。 @@ -215,7 +215,7 @@ public: 如图: -![42.接雨水4](https://code-thinking-1253855093.file.myqcloud.com/pics/2021022309321229.png) +![42.接雨水4](https://file.kamacoder.com/pics/2021022309321229.png) 关于单调栈的顺序给大家一个总结: [739. 每日温度](https://programmercarl.com/0739.每日温度.html) 中求一个元素右边第一个更大元素,单调栈就是递增的,[84.柱状图中最大的矩形](https://programmercarl.com/0084.柱状图中最大的矩形.html)求一个元素右边第一个更小元素,单调栈就是递减的。 @@ -229,7 +229,7 @@ public: 如图所示: -![42.接雨水5](https://code-thinking-1253855093.file.myqcloud.com/pics/20210223094619398.png) +![42.接雨水5](https://file.kamacoder.com/pics/20210223094619398.png) 4. 栈里要保存什么数值 @@ -284,7 +284,7 @@ if (height[i] == height[st.top()]) { // 例如 5 5 1 7 这种情况 如果当前遍历的元素(柱子)高度大于栈顶元素的高度,此时就出现凹槽了,如图所示: -![42.接雨水4](https://code-thinking-1253855093.file.myqcloud.com/pics/2021022309321229-20230310123027977.png) +![42.接雨水4](https://file.kamacoder.com/pics/2021022309321229-20230310123027977.png) 取栈顶元素,将栈顶元素弹出,这个就是凹槽的底部,也就是中间位置,下标记为mid,对应的高度为height[mid](就是图中的高度1)。 diff --git "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" index a20eb2a6a9..dd51384d77 100644 --- "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" +++ "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" @@ -47,7 +47,7 @@ 如图: -![45.跳跃游戏II](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232309103.png) +![45.跳跃游戏II](https://file.kamacoder.com/pics/20201201232309103.png) **图中覆盖范围的意义在于,只要红色的区域,最多两步一定可以到!(不用管具体怎么跳,反正一定可以跳到)** @@ -99,11 +99,11 @@ public: 因为当移动下标指向 nums.size - 2 时: - 如果移动下标等于当前覆盖最大距离下标, 需要再走一步(即 ans++),因为最后一步一定是可以到的终点。(题目假设总是可以到达数组的最后一个位置),如图: - ![45.跳跃游戏II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232445286.png) + ![45.跳跃游戏II2](https://file.kamacoder.com/pics/20201201232445286.png) - 如果移动下标不等于当前覆盖最大距离下标,说明当前覆盖最远距离就可以直接达到终点了,不需要再走一步。如图: -![45.跳跃游戏II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232338693.png) +![45.跳跃游戏II1](https://file.kamacoder.com/pics/20201201232338693.png) 代码如下: diff --git "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" index 611a4cb1e0..5a190242e3 100644 --- "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" +++ "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" @@ -41,7 +41,7 @@ 我以[1,2,3]为例,抽象成树形结构如下: -![全排列](https://code-thinking-1253855093.file.myqcloud.com/pics/20240803180318.png) +![全排列](https://file.kamacoder.com/pics/20240803180318.png) ### 回溯三部曲 @@ -53,7 +53,7 @@ 但排列问题需要一个used数组,标记已经选择的元素,如图橘黄色部分所示: -![全排列](https://code-thinking-1253855093.file.myqcloud.com/pics/20240803180318.png) +![全排列](https://file.kamacoder.com/pics/20240803180318.png) 代码如下: @@ -65,7 +65,7 @@ void backtracking (vector& nums, vector& used) * 递归终止条件 -![全排列](https://code-thinking-1253855093.file.myqcloud.com/pics/20240803180318.png) +![全排列](https://file.kamacoder.com/pics/20240803180318.png) 可以看出叶子节点,就是收割结果的地方。 diff --git "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" index 1e51a7bcd7..6ed794aaaf 100644 --- "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" +++ "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" @@ -48,7 +48,7 @@ 我以示例中的 [1,1,2]为例 (为了方便举例,已经排序)抽象为一棵树,去重过程如图: -![47.全排列II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124201331223.png) +![47.全排列II1](https://file.kamacoder.com/pics/20201124201331223.png) 图中我们对同一树层,前一位(也就是nums[i-1])如果使用过,那么就进行去重。 @@ -130,11 +130,11 @@ if (i > 0 && nums[i] == nums[i - 1] && used[i - 1] == true) { 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124201406192.png) +![47.全排列II2](https://file.kamacoder.com/pics/20201124201406192.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124201431571.png) +![47.全排列II3](https://file.kamacoder.com/pics/20201124201431571.png) 大家应该很清晰的看到,树层上对前一位去重非常彻底,效率很高,树枝上对前一位去重虽然最后可以得到答案,但是做了很多无用搜索。 diff --git "a/problems/0051.N\347\232\207\345\220\216.md" "b/problems/0051.N\347\232\207\345\220\216.md" index b201b55fe4..2a90a023e6 100644 --- "a/problems/0051.N\347\232\207\345\220\216.md" +++ "b/problems/0051.N\347\232\207\345\220\216.md" @@ -15,7 +15,7 @@ n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上, 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211020232201.png) +![](https://file.kamacoder.com/pics/20211020232201.png) * 输入:n = 4 * 输出:[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]] @@ -45,7 +45,7 @@ n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上, 下面我用一个 3 * 3 的棋盘,将搜索过程抽象为一棵树,如图: -![51.N皇后](https://code-thinking-1253855093.file.myqcloud.com/pics/20210130182532303.jpg) +![51.N皇后](https://file.kamacoder.com/pics/20210130182532303.jpg) 从图中,可以看出,二维矩阵中矩阵的高就是这棵树的高度,矩阵的宽就是树形结构中每一个节点的宽度。 @@ -85,7 +85,7 @@ void backtracking(int n, int row, vector& chessboard) { * 递归终止条件 在如下树形结构中: -![51.N皇后](https://code-thinking-1253855093.file.myqcloud.com/pics/20210130182532303-20230310122134167.jpg) +![51.N皇后](https://file.kamacoder.com/pics/20210130182532303-20230310122134167.jpg) 可以看出,当递归到棋盘最底层(也就是叶子节点)的时候,就可以收集结果并返回了。 diff --git "a/problems/0052.N\347\232\207\345\220\216II.md" "b/problems/0052.N\347\232\207\345\220\216II.md" index 11c257b073..489ab1f756 100644 --- "a/problems/0052.N\347\232\207\345\220\216II.md" +++ "b/problems/0052.N\347\232\207\345\220\216II.md" @@ -13,7 +13,7 @@ n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并 上图为 8 皇后问题的一种解法。 -![51n皇后](https://code-thinking-1253855093.file.myqcloud.com/pics/20200821152118456.png) +![51n皇后](https://file.kamacoder.com/pics/20200821152118456.png) 给定一个整数 n,返回 n 皇后不同的解决方案的数量。 diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" index 568626dc6d..174f55e848 100644 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -54,7 +54,7 @@ dp[0]应该是多少呢? 5. 举例推导dp数组 以示例一为例,输入:nums = [-2,1,-3,4,-1,2,1,-5,4],对应的dp状态如下: -![53.最大子序和(动态规划)](https://code-thinking-1253855093.file.myqcloud.com/pics/20210303104129101.png) +![53.最大子序和(动态规划)](https://file.kamacoder.com/pics/20210303104129101.png) **注意最后的结果可不是dp[nums.size() - 1]!** ,而是dp[6]。 diff --git "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" index 7d7f460f01..a852b6740d 100644 --- "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" +++ "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" @@ -36,7 +36,7 @@ 由外向内一圈一圈这么画下去,如下所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220922102236.png) +![](https://file.kamacoder.com/pics/20220922102236.png) 这里每一种颜色,代表一条边,我们遍历的长度,可以看出每一个拐角处的处理规则,拐角处让给新的一条边来继续画。 diff --git "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" index 3ab004b2aa..0ebbcb595c 100644 --- "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" +++ "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" @@ -48,7 +48,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230203105634.png) +![](https://file.kamacoder.com/pics/20230203105634.png) i 每次移动只能在 cover 的范围内移动,每移动一个元素,cover 得到该元素数值(新的覆盖范围)的补充,让 i 继续移动下去。 diff --git "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" index 76792dbae1..cb06fcab3d 100644 --- "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" +++ "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" @@ -38,7 +38,7 @@ 这么说有点抽象,看图:(**注意图中区间都是按照左边界排序之后了**) -![56.合并区间](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223200632791.png) +![56.合并区间](https://file.kamacoder.com/pics/20201223200632791.png) 知道如何判断重复之后,剩下的就是合并了,如何去模拟合并区间呢? diff --git "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" index 9961c0e70b..d7aea257a5 100644 --- "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" +++ "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" @@ -54,7 +54,7 @@ 那么我按照左闭右开的原则,来画一圈,大家看一下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220922102236.png) +![](https://file.kamacoder.com/pics/20220922102236.png) 这里每一种颜色,代表一条边,我们遍历的长度,可以看出每一个拐角处的处理规则,拐角处让给新的一条边来继续画。 diff --git "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" index 23cd8060fa..20bd56ba9f 100644 --- "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" +++ "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" @@ -16,7 +16,7 @@ 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110174033215.png) +![](https://file.kamacoder.com/pics/20210110174033215.png) * 输入:m = 3, n = 7 * 输出:28 @@ -62,7 +62,7 @@ 如图举例: -![62.不同路径](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209113602700.png) +![62.不同路径](https://file.kamacoder.com/pics/20201209113602700.png) 此时问题就可以转化为求二叉树叶子节点的个数,代码如下: @@ -131,7 +131,7 @@ for (int j = 0; j < n; j++) dp[0][j] = 1; 如图所示: -![62.不同路径1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209113631392.png) +![62.不同路径1](https://file.kamacoder.com/pics/20201209113631392.png) 以上动规五部曲分析完毕,C++代码如下: @@ -180,7 +180,7 @@ public: 在这个图中,可以看出一共m,n的话,无论怎么走,走到终点都需要 m + n - 2 步。 -![62.不同路径](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209113602700-20230310120944078.png) +![62.不同路径](https://file.kamacoder.com/pics/20201209113602700-20230310120944078.png) 在这m + n - 2 步中,一定有 m - 1 步是要向下走的,不用管什么时候向下走。 @@ -190,7 +190,7 @@ public: 那么答案,如图所示: -![62.不同路径2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209113725324.png) +![62.不同路径2](https://file.kamacoder.com/pics/20201209113725324.png) **求组合的时候,要防止两个int相乘溢出!** 所以不能把算式的分子都算出来,分母都算出来再做除法。 diff --git "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" index 61d9329d4b..d39036ba3a 100644 --- "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" +++ "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" @@ -14,13 +14,13 @@ 现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径? -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210111204901338.png) +![](https://file.kamacoder.com/pics/20210111204901338.png) 网格中的障碍物和空位置分别用 1 和 0 来表示。 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210111204939971.png) +![](https://file.kamacoder.com/pics/20210111204939971.png) * 输入:obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]] * 输出:2 @@ -32,7 +32,7 @@ 示例 2: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210111205857918.png) +![](https://file.kamacoder.com/pics/20210111205857918.png) * 输入:obstacleGrid = [[0,1],[0,0]] * 输出:1 @@ -93,7 +93,7 @@ for (int j = 0; j < n; j++) dp[0][j] = 1; 如图: -![63.不同路径II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114513928.png) +![63.不同路径II](https://file.kamacoder.com/pics/20210104114513928.png) 下标(0, j)的初始化情况同理。 @@ -127,11 +127,11 @@ for (int i = 1; i < m; i++) { 拿示例1来举例如题: -![63.不同路径II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114548983.png) +![63.不同路径II1](https://file.kamacoder.com/pics/20210104114548983.png) 对应的dp table 如图: -![63.不同路径II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114610256.png) +![63.不同路径II2](https://file.kamacoder.com/pics/20210104114610256.png) 如果这个图看不懂,建议再理解一下递归公式,然后照着文章中说的遍历顺序,自己推导一下! diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" index 92c3858698..17bf3ee760 100644 --- "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" @@ -101,7 +101,7 @@ dp[i]: 爬到第i层楼梯,有dp[i]种方法 举例当n为5的时候,dp table(dp数组)应该是这样的 -![70.爬楼梯](https://code-thinking-1253855093.file.myqcloud.com/pics/20210105202546299.png) +![70.爬楼梯](https://file.kamacoder.com/pics/20210105202546299.png) 如果代码出问题了,就把dp table 打印出来,看看究竟是不是和自己推导的一样。 diff --git "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" index 408999d873..192ea47002 100644 --- "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" +++ "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" @@ -170,7 +170,7 @@ for (int j = 0; j <= word2.size(); j++) dp[0][j] = j; 可以看出dp[i][j]是依赖左方,上方和左上方元素的,如图: -![72.编辑距离](https://code-thinking-1253855093.file.myqcloud.com/pics/20210114162113131.jpg) +![72.编辑距离](https://file.kamacoder.com/pics/20210114162113131.jpg) 所以在dp矩阵中一定是从左到右从上到下去遍历。 @@ -194,7 +194,7 @@ for (int i = 1; i <= word1.size(); i++) { 以示例1为例,输入:`word1 = "horse", word2 = "ros"`为例,dp矩阵状态图如下: -![72.编辑距离1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210114162132300.jpg) +![72.编辑距离1](https://file.kamacoder.com/pics/20210114162132300.jpg) 以上动规五部分析完毕,C++代码如下: diff --git "a/problems/0077.\347\273\204\345\220\210.md" "b/problems/0077.\347\273\204\345\220\210.md" index 60900d76a6..c523c01c17 100644 --- "a/problems/0077.\347\273\204\345\220\210.md" +++ "b/problems/0077.\347\273\204\345\220\210.md" @@ -82,7 +82,7 @@ for (int i = 1; i <= n; i++) { 那么我把组合问题抽象为如下树形结构: -![77.组合](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195223940.png) +![77.组合](https://file.kamacoder.com/pics/20201123195223940.png) 可以看出这棵树,一开始集合是 1,2,3,4, 从左向右取数,取过的数,不再重复取。 @@ -126,7 +126,7 @@ vector path; // 用来存放符合条件结果 从下图中红线部分可以看出,在集合[1,2,3,4]取1之后,下一层递归,就要在[2,3,4]中取数了,那么下一层递归如何知道从[2,3,4]中取数呢,靠的就是startIndex。 -![77.组合2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195328976.png) +![77.组合2](https://file.kamacoder.com/pics/20201123195328976.png) 所以需要startIndex来记录下一层递归,搜索的起始位置。 @@ -146,7 +146,7 @@ path这个数组的大小如果达到k,说明我们找到了一个子集大小 如图红色部分: -![77.组合3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195407907.png) +![77.组合3](https://file.kamacoder.com/pics/20201123195407907.png) 此时用result二维数组,把path保存起来,并终止本层递归。 @@ -163,7 +163,7 @@ if (path.size() == k) { 回溯法的搜索过程就是一个树型结构的遍历过程,在如下图中,可以看出for循环用来横向遍历,递归的过程是纵向遍历。 -![77.组合1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195242899.png) +![77.组合1](https://file.kamacoder.com/pics/20201123195242899.png) 如此我们才遍历完图中的这棵树。 @@ -267,7 +267,7 @@ for (int i = startIndex; i <= n; i++) { 这么说有点抽象,如图所示: -![77.组合4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210130194335207-20230310134409532.png) +![77.组合4](https://file.kamacoder.com/pics/20210130194335207-20230310134409532.png) 图中每一个节点(图中为矩形),就代表本层的一个for循环,那么每一层的for循环从第二个数开始遍历的话,都没有意义,都是无效遍历。 diff --git "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" index e2ca3d7d0a..c5e26e7706 100644 --- "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" +++ "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" @@ -67,7 +67,7 @@ for (int i = startIndex; i <= n; i++) { 这么说有点抽象,如图所示: -![77.组合4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210130194335207.png) +![77.组合4](https://file.kamacoder.com/pics/20210130194335207.png) 图中每一个节点(图中为矩形),就代表本层的一个for循环,那么每一层的for循环从第二个数开始遍历的话,都没有意义,都是无效遍历。 diff --git "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" index 6577cf542d..e1a6671e73 100644 --- "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" +++ "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" @@ -11,9 +11,9 @@ 求在该柱状图中,能够勾勒出来的矩形的最大面积。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210803220437.png) +![](https://file.kamacoder.com/pics/20210803220437.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210803220506.png) +![](https://file.kamacoder.com/pics/20210803220506.png) * 1 <= heights.length <=10^5 * 0 <= heights[i] <= 10^4 @@ -114,7 +114,7 @@ public: 我来举一个例子,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230221165730.png) +![](https://file.kamacoder.com/pics/20230221165730.png) 只有栈里从大到小的顺序,才能保证栈顶元素找到左右两边第一个小于栈顶元素的柱子。 @@ -179,7 +179,7 @@ public: 如果数组本身就是升序的,例如[2,4,6,8],那么入栈之后 都是单调递减,一直都没有走 情况三 计算结果的哪一步,所以最后输出的就是0了。 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230221163936.png) +![](https://file.kamacoder.com/pics/20230221163936.png) 那么结尾加一个0,就会让栈里的所有元素,走到情况三的逻辑。 @@ -194,7 +194,7 @@ public: 之后又将6 加入栈(此时8已经弹出了),然后 就是 4 与 栈口元素 6 进行比较,周而复始,那么计算的最后结果result就是0。 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230221164533.png) +![](https://file.kamacoder.com/pics/20230221164533.png) 所以我们需要在 height数组前后各加一个元素0。 diff --git "a/problems/0090.\345\255\220\351\233\206II.md" "b/problems/0090.\345\255\220\351\233\206II.md" index 3bda02bc9e..2f26e6068f 100644 --- "a/problems/0090.\345\255\220\351\233\206II.md" +++ "b/problems/0090.\345\255\220\351\233\206II.md" @@ -39,7 +39,7 @@ 用示例中的[1, 2, 2] 来举例,如图所示: (**注意去重需要先对集合排序**) -![90.子集II](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124195411977.png) +![90.子集II](https://file.kamacoder.com/pics/20201124195411977.png) 从图中可以看出,同一树层上重复取2 就要过滤掉,同一树枝上就可以重复取2,因为同一树枝上元素的集合才是唯一子集! diff --git "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" index 1a89827897..5ef2162898 100644 --- "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" +++ "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" @@ -54,7 +54,7 @@ 切割问题可以抽象为树型结构,如图: -![93.复原IP地址](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123203735933.png) +![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933.png) ### 回溯三部曲 @@ -106,7 +106,7 @@ if (pointNum == 3) { // 逗点数量为3时,分隔结束 如果不合法就结束本层循环,如图中剪掉的分支: -![93.复原IP地址](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123203735933-20230310132314109.png) +![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933-20230310132314109.png) 然后就是递归和回溯的过程: diff --git "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index f4e0e456b7..ca99a46695 100644 --- "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -12,7 +12,7 @@ 示例: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210113161941835.png) +![](https://file.kamacoder.com/pics/20210113161941835.png) ## 算法公开课 @@ -27,11 +27,11 @@ 了解了二叉搜索树之后,我们应该先举几个例子,画画图,看看有没有什么规律,如图: -![96.不同的二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210107093106367.png) +![96.不同的二叉搜索树](https://file.kamacoder.com/pics/20210107093106367.png) n为1的时候有一棵树,n为2有两棵树,这个是很直观的。 -![96.不同的二叉搜索树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210107093129889.png) +![96.不同的二叉搜索树1](https://file.kamacoder.com/pics/20210107093129889.png) 来看看n为3的时候,有哪几种情况。 @@ -65,7 +65,7 @@ dp[3],就是 元素1为头结点搜索树的数量 + 元素2为头结点搜索 如图所示: -![96.不同的二叉搜索树2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210107093226241.png) +![96.不同的二叉搜索树2](https://file.kamacoder.com/pics/20210107093226241.png) 此时我们已经找到递推关系了,那么可以用动规五部曲再系统分析一遍。 @@ -118,7 +118,7 @@ for (int i = 1; i <= n; i++) { n为5时候的dp数组状态如图: -![96.不同的二叉搜索树3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210107093253987.png) +![96.不同的二叉搜索树3](https://file.kamacoder.com/pics/20210107093253987.png) 当然如果自己画图举例的话,基本举例到n为3就可以了,n为4的时候,画图已经比较麻烦了。 diff --git "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index 22a47f9632..9569cbddf1 100644 --- "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -16,7 +16,7 @@ * 节点的右子树只包含大于当前节点的数。 * 所有左子树和右子树自身必须也是二叉搜索树。 -![98.验证二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000750.png) +![98.验证二叉搜索树](https://file.kamacoder.com/pics/20230310000750.png) ## 算法公开课 @@ -102,7 +102,7 @@ if (root->val > root->left->val && root->val < root->right->val) { 例如: [10,5,15,null,null,6,20] 这个case: -![二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000824.png) +![二叉搜索树](https://file.kamacoder.com/pics/20230310000824.png) 节点10大于左节点5,小于右节点15,但右子树里出现了一个6 这就不符合了! diff --git "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" index 52c9fcf2e7..e5f610009e 100644 --- "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" +++ "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" @@ -12,9 +12,9 @@ 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210726172932.png) +![](https://file.kamacoder.com/pics/20210726172932.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210726173011.png) +![](https://file.kamacoder.com/pics/20210726173011.png) ## 思路 diff --git "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" index f066408408..205597b068 100644 --- "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" @@ -9,7 +9,7 @@ 给定一个二叉树,检查它是否是镜像对称的。 -![101. 对称二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203144607387.png) +![101. 对称二叉树](https://file.kamacoder.com/pics/20210203144607387.png) ## 算法公开课 @@ -25,7 +25,7 @@ 比较的是两个子树的里侧和外侧的元素是否相等。如图所示: -![101. 对称二叉树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203144624414.png) +![101. 对称二叉树1](https://file.kamacoder.com/pics/20210203144624414.png) 那么遍历的顺序应该是什么样的呢? diff --git "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" index da2d85c99d..6725d72cc2 100644 --- "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" +++ "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" @@ -37,7 +37,7 @@ 给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 -![102.二叉树的层序遍历](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203144842988.png) +![102.二叉树的层序遍历](https://file.kamacoder.com/pics/20210203144842988.png) ### 思路 @@ -532,7 +532,7 @@ public IList> LevelOrder(TreeNode root) 给定一个二叉树,返回其节点值自底向上的层次遍历。 (即按从叶子节点所在层到根节点所在的层,逐层从左向右遍历) -![107.二叉树的层次遍历II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203151058308.png) +![107.二叉树的层次遍历II](https://file.kamacoder.com/pics/20210203151058308.png) ### 思路 @@ -926,7 +926,7 @@ public IList> LevelOrderBottom(TreeNode root) 给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。 -![199.二叉树的右视图](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203151307377.png) +![199.二叉树的右视图](https://file.kamacoder.com/pics/20210203151307377.png) ### 思路 @@ -1276,7 +1276,7 @@ public class Solution 给定一个非空二叉树, 返回一个由每层节点平均值组成的数组。 -![637.二叉树的层平均值](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203151350500.png) +![637.二叉树的层平均值](https://file.kamacoder.com/pics/20210203151350500.png) ### 思路 @@ -1634,7 +1634,7 @@ public class Solution { 例如,给定一个 3叉树 : -![429. N叉树的层序遍历](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203151439168.png) +![429. N叉树的层序遍历](https://file.kamacoder.com/pics/20210203151439168.png) 返回其层序遍历: @@ -2006,7 +2006,7 @@ impl Solution { 您需要在二叉树的每一行中找到最大的值。 -![515.在每个树行中找最大值](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203151532153.png) +![515.在每个树行中找最大值](https://file.kamacoder.com/pics/20210203151532153.png) ### 思路 @@ -2337,7 +2337,7 @@ struct Node { 初始状态下,所有 next 指针都被设置为 NULL。 -![116.填充每个节点的下一个右侧节点指针](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203152044855.jpg) +![116.填充每个节点的下一个右侧节点指针](https://file.kamacoder.com/pics/20210203152044855.jpg) ### 思路 @@ -2971,7 +2971,7 @@ object Solution { 给定二叉树 [3,9,20,null,null,15,7], -![104. 二叉树的最大深度](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203153031914-20230310134849764.png) +![104. 二叉树的最大深度](https://file.kamacoder.com/pics/20210203153031914-20230310134849764.png) 返回它的最大深度 3 。 @@ -2981,7 +2981,7 @@ object Solution { 在二叉树中,一层一层的来遍历二叉树,记录一下遍历的层数就是二叉树的深度,如图所示: -![层序遍历](https://code-thinking-1253855093.file.myqcloud.com/pics/20200810193056585-20230310134854803.png) +![层序遍历](https://file.kamacoder.com/pics/20200810193056585-20230310134854803.png) 所以这道题的迭代法就是一道模板题,可以使用二叉树层序遍历的模板来解决的。 diff --git "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" index 6b9994ed93..2eb22ae5a3 100644 --- "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" +++ "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" @@ -18,7 +18,7 @@ 给定二叉树 [3,9,20,null,null,15,7], -![104. 二叉树的最大深度](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203153031914-20230310121809902.png) +![104. 二叉树的最大深度](https://file.kamacoder.com/pics/20210203153031914-20230310121809902.png) 返回它的最大深度 3 。 @@ -172,7 +172,7 @@ public: 在二叉树中,一层一层的来遍历二叉树,记录一下遍历的层数就是二叉树的深度,如图所示: -![层序遍历](https://code-thinking-1253855093.file.myqcloud.com/pics/20200810193056585.png) +![层序遍历](https://file.kamacoder.com/pics/20200810193056585.png) 所以这道题的迭代法就是一道模板题,可以使用二叉树层序遍历的模板来解决的。 @@ -217,7 +217,7 @@ public: 例如,给定一个 3叉树 : -![559.n叉树的最大深度](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020315313214.png) +![559.n叉树的最大深度](https://file.kamacoder.com/pics/2021020315313214.png) 我们应返回其最大深度,3。 diff --git "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" index d0af8fef27..2f8e5eefb6 100644 --- "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" @@ -25,7 +25,7 @@ * 后序遍历 postorder = [9,15,7,20,3] 返回如下的二叉树: -![106. 从中序与后序遍历序列构造二叉树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203154316774.png) +![106. 从中序与后序遍历序列构造二叉树1](https://file.kamacoder.com/pics/20210203154316774.png) ## 算法公开课 @@ -40,7 +40,7 @@ 流程如图: -![106.从中序与后序遍历序列构造二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203154249860.png) +![106.从中序与后序遍历序列构造二叉树](https://file.kamacoder.com/pics/20210203154249860.png) 那么代码应该怎么写呢? @@ -411,7 +411,7 @@ public: 中序遍历 inorder = [9,3,15,20,7] 返回如下的二叉树: -![105. 从前序与中序遍历序列构造二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203154626672.png) +![105. 从前序与中序遍历序列构造二叉树](https://file.kamacoder.com/pics/20210203154626672.png) ### 思路 @@ -554,7 +554,7 @@ public: 举一个例子: -![106.从中序与后序遍历序列构造二叉树2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203154720326.png) +![106.从中序与后序遍历序列构造二叉树2](https://file.kamacoder.com/pics/20210203154720326.png) tree1 的前序遍历是[1 2 3], 后序遍历是[3 2 1]。 diff --git "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index adb2a06082..5829e2d220 100644 --- "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -16,7 +16,7 @@ 示例: -![108.将有序数组转换为二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20201022164420763.png) +![108.将有序数组转换为二叉搜索树](https://file.kamacoder.com/pics/20201022164420763.png) ## 算法公开课 @@ -40,7 +40,7 @@ 例如 有序数组[-10,-3,0,5,9] 就可以构造成这样的二叉搜索树,如图。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220930173553.png) +![](https://file.kamacoder.com/pics/20220930173553.png) 上图中,是符合二叉搜索树的特性吧,如果要这么做的话,是不是本题意义就不大了,所以才强调是平衡二叉搜索树。 diff --git "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" index c3da728077..ff84ad8471 100644 --- "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" @@ -19,7 +19,7 @@ 给定二叉树 [3,9,20,null,null,15,7] -![110.平衡二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020315542230.png) +![110.平衡二叉树](https://file.kamacoder.com/pics/2021020315542230.png) 返回 true 。 @@ -27,7 +27,7 @@ 给定二叉树 [1,2,2,3,3,null,null,4,4] -![110.平衡二叉树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203155447919.png) +![110.平衡二叉树1](https://file.kamacoder.com/pics/20210203155447919.png) 返回 false 。 @@ -46,7 +46,7 @@ 但leetcode中强调的深度和高度很明显是按照节点来计算的,如图: -![110.平衡二叉树2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203155515650.png) +![110.平衡二叉树2](https://file.kamacoder.com/pics/20210203155515650.png) 关于根节点的深度究竟是1 还是 0,不同的地方有不一样的标准,leetcode的题目中都是以节点为一度,即根节点深度是1。但维基百科上定义用边为一度,即根节点的深度是0,我们暂时以leetcode为准(毕竟要在这上面刷题)。 diff --git "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" index a77594b28f..bd4ea29d6c 100644 --- "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" +++ "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" @@ -20,7 +20,7 @@ 给定二叉树 [3,9,20,null,null,15,7], -![111.二叉树的最小深度1](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020315582586.png) +![111.二叉树的最小深度1](https://file.kamacoder.com/pics/2021020315582586.png) 返回它的最小深度 2. diff --git "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" index 22ed777fba..24891acee9 100644 --- "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" +++ "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" @@ -15,7 +15,7 @@ 示例: 给定如下二叉树,以及目标和 sum = 22, -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230407210247.png) +![](https://file.kamacoder.com/pics/20230407210247.png) 返回 true, 因为存在目标和为 22 的根节点到叶子节点的路径 5->4->11->2。 @@ -53,7 +53,7 @@ 如图所示: -![112.路径总和](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020316051216.png) +![112.路径总和](https://file.kamacoder.com/pics/2021020316051216.png) 图中可以看出,遍历的路线,并不要遍历整棵树,所以递归函数需要返回值,可以用bool类型表示。 @@ -230,7 +230,7 @@ public: 给定如下二叉树,以及目标和 sum = 22, -![113.路径总和ii1.png](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203160854654.png) +![113.路径总和ii1.png](https://file.kamacoder.com/pics/20210203160854654.png) ### 思路 @@ -239,7 +239,7 @@ public: 如图: -![113.路径总和ii](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203160922745.png) +![113.路径总和ii](https://file.kamacoder.com/pics/20210203160922745.png) 为了尽可能的把细节体现出来,我写出如下代码(**这份代码并不简洁,但是逻辑非常清晰**) diff --git "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" index 832b64d183..1df3d899a8 100644 --- "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" @@ -70,7 +70,7 @@ dp[i][j]:以i-1为结尾的s子序列中出现以j-1为结尾的t的个数为d 从递推公式dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]; 和 dp[i][j] = dp[i - 1][j]; 中可以看出dp[i][j] 是从上方和左上方推导而来,如图:,那么 dp[i][0] 和dp[0][j]是一定要初始化的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221222165412.png) +![](https://file.kamacoder.com/pics/20221222165412.png) 每次当初始化的时候,都要回顾一下dp[i][j]的定义,不要凭感觉初始化。 @@ -101,7 +101,7 @@ for (int j = 1; j <= t.size(); j++) dp[0][j] = 0; // 其实这行代码可以和 从递推公式dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]; 和 dp[i][j] = dp[i - 1][j]; 中可以看出dp[i][j]都是根据左上方和正上方推出来的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221222165412.png) +![](https://file.kamacoder.com/pics/20221222165412.png) 所以遍历的时候一定是从上到下,从左到右,这样保证dp[i][j]可以根据之前计算出来的数值进行计算。 diff --git "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" index 234929f3d1..9de1de1ee5 100644 --- "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" +++ "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" @@ -26,7 +26,7 @@ struct Node { * 你只能使用常量级额外空间。 * 使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空间复杂度。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727143202.png) +![](https://file.kamacoder.com/pics/20210727143202.png) ## 思路 diff --git "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" index b9df47a491..f82ed962fa 100644 --- "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" +++ "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" @@ -129,7 +129,7 @@ dp[0][1]表示第0天不持有股票,不持有股票那么现金就是0,所 以示例1,输入:[7,1,5,3,6,4]为例,dp数组状态如下: -![121.买卖股票的最佳时机](https://code-thinking-1253855093.file.myqcloud.com/pics/20210224225642465.png) +![121.买卖股票的最佳时机](https://file.kamacoder.com/pics/20210224225642465.png) dp[5][1]就是最终结果。 diff --git "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" index b268040771..4ccb17bbfd 100644 --- "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" +++ "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" @@ -66,7 +66,7 @@ 如图: -![122.买卖股票的最佳时机II](https://code-thinking-1253855093.file.myqcloud.com/pics/2020112917480858-20230310134659477.png) +![122.买卖股票的最佳时机II](https://file.kamacoder.com/pics/2020112917480858-20230310134659477.png) 一些同学陷入:第一天怎么就没有利润呢,第一天到底算不算的困惑中。 diff --git "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" index 75f7cb3f20..c4ff89a0c5 100644 --- "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" +++ "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" @@ -120,7 +120,7 @@ dp[i][4] = max(dp[i - 1][4], dp[i - 1][3] + prices[i]); 以输入[1,2,3,4,5]为例 -![123.买卖股票的最佳时机III](https://code-thinking-1253855093.file.myqcloud.com/pics/20201228181724295-20230310134201291.png) +![123.买卖股票的最佳时机III](https://file.kamacoder.com/pics/20201228181724295-20230310134201291.png) 大家可以看到红色框为最后两次卖出的状态。 diff --git "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" index 556613e587..1ce0bc11a7 100644 --- "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" +++ "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" @@ -31,7 +31,7 @@ 以示例1为例,从这个图中可以看出 hit 到 cog的路线,不止一条,有三条,一条是最短的长度为5,两条长度为6。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210827175432.png) +![](https://file.kamacoder.com/pics/20210827175432.png) 本题只需要求出最短路径的长度就可以了,不用找出路径。 diff --git "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" index 4eeb57143e..278c12eccc 100644 --- "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" +++ "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" @@ -8,7 +8,7 @@ 给你一个 m x n 的矩阵 board ,由若干字符 'X' 和 'O' ,找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220901104745.png) +![](https://file.kamacoder.com/pics/20220901104745.png) * 输入:board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]] * 输出:[["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O","X","X"]] @@ -28,11 +28,11 @@ 步骤一:深搜或者广搜将地图周边的'O'全部改成'A',如图所示: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220902102337.png) +![图一](https://file.kamacoder.com/pics/20220902102337.png) 步骤二:在遍历地图,将'O'全部改成'X'(地图中间的'O'改成了'X'),将'A'改回'O'(保留的地图周边的'O'),如图所示: -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220902102831.png) +![图二](https://file.kamacoder.com/pics/20220902102831.png) 整体C++代码如下,以下使用dfs实现,其实遍历方式dfs,bfs都是可以的。 diff --git "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" index 2117a44801..089dd52c78 100644 --- "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" +++ "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" @@ -161,7 +161,7 @@ for (int i = s.size() - 1; i >= 0; i--) { 以输入:"aabc" 为例: -![132.分割回文串II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210124182218844.jpg) +![132.分割回文串II](https://file.kamacoder.com/pics/20210124182218844.jpg) 以上分析完毕,代码如下: diff --git "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" index fdf3e0d3db..354f642448 100644 --- "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" +++ "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" @@ -144,7 +144,7 @@ i从0开始累加rest[i],和记为curSum,一旦curSum小于零,说明[0, i 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230117165628.png) +![](https://file.kamacoder.com/pics/20230117165628.png) 那么为什么一旦[0,i] 区间和为负数,起始位置就可以是i+1呢,i+1后面就不会出现更大的负数? @@ -152,7 +152,7 @@ i从0开始累加rest[i],和记为curSum,一旦curSum小于零,说明[0, i 那有没有可能 [0,i] 区间 选某一个作为起点,累加到 i这里 curSum是不会小于零呢? 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230117170703.png) +![](https://file.kamacoder.com/pics/20230117170703.png) 如果 curSum<0 说明 区间和1 + 区间和2 < 0, 那么 假设从上图中的位置开始计数curSum不会小于0的话,就是 区间和2>0。 diff --git "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" index 75cce157c6..30df21495e 100644 --- "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" +++ "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" @@ -56,7 +56,7 @@ for (int i = 1; i < ratings.size(); i++) { 如图: -![135.分发糖果](https://code-thinking-1253855093.file.myqcloud.com/pics/20201117114916878.png) +![135.分发糖果](https://file.kamacoder.com/pics/20201117114916878.png) 再确定左孩子大于右孩子的情况(从后向前遍历) @@ -66,7 +66,7 @@ for (int i = 1; i < ratings.size(); i++) { 如果从前向后遍历,rating[5]与rating[4]的比较 就不能用上 rating[5]与rating[6]的比较结果了 。如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230202102044.png) +![](https://file.kamacoder.com/pics/20230202102044.png) **所以确定左孩子大于右孩子的情况一定要从后向前遍历!** @@ -82,7 +82,7 @@ for (int i = 1; i < ratings.size(); i++) { 如图: -![135.分发糖果1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201117115658791.png) +![135.分发糖果1](https://file.kamacoder.com/pics/20201117115658791.png) 所以该过程代码如下: diff --git "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" index b74d2cdfa0..513d327ba1 100644 --- "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" +++ "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" @@ -180,7 +180,7 @@ dp[0]表示如果字符串为空的话,说明出现在字典里。 以输入: s = "leetcode", wordDict = ["leet", "code"]为例,dp状态如图: -![139.单词拆分](https://code-thinking-1253855093.file.myqcloud.com/pics/20210202162652727.jpg) +![139.单词拆分](https://file.kamacoder.com/pics/20210202162652727.jpg) dp[s.size()]就是最终结果。 @@ -241,7 +241,7 @@ public: 使用用例:s = "applepenapple", wordDict = ["apple", "pen"],对应的dp数组状态如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240809155103.png) +![](https://file.kamacoder.com/pics/20240809155103.png) 最后dp[s.size()] = 0 即 dp[13] = 0 ,而不是1,因为先用 "apple" 去遍历的时候,dp[8]并没有被赋值为1 (还没用"pen"),所以 dp[13]也不能变成1。 diff --git "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" index 4957e9fbd5..685a92d529 100644 --- "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" +++ "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" @@ -13,7 +13,7 @@ 如果链表中存在环,则返回 true 。 否则,返回 false 。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727173600.png) +![](https://file.kamacoder.com/pics/20210727173600.png) ## 思路 diff --git "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" index fb8b875f7d..6cfabc60f6 100644 --- "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" +++ "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" @@ -20,7 +20,7 @@ **说明**:不允许修改给定的链表。 -![循环链表](https://code-thinking-1253855093.file.myqcloud.com/pics/20200816110112704.png) +![循环链表](https://file.kamacoder.com/pics/20200816110112704.png) ## 算法公开课 @@ -50,7 +50,7 @@ 会发现最终都是这种情况, 如下图: -![142环形链表1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210318162236720.png) +![142环形链表1](https://file.kamacoder.com/pics/20210318162236720.png) fast和slow各自再走一步, fast和slow就相遇了 @@ -70,7 +70,7 @@ fast和slow各自再走一步, fast和slow就相遇了 环形入口节点到 fast指针与slow指针相遇节点 节点数为y。 从相遇节点 再到环形入口节点节点数为 z。 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220925103433.png) +![](https://file.kamacoder.com/pics/20220925103433.png) 那么相遇时: slow指针走过的节点数为: `x + y`, @@ -154,20 +154,20 @@ public: 即文章[链表:环找到了,那入口呢?](https://programmercarl.com/0142.环形链表II.html)中如下的地方: -![142环形链表5](https://code-thinking-1253855093.file.myqcloud.com/pics/20210318165123581.png) +![142环形链表5](https://file.kamacoder.com/pics/20210318165123581.png) 首先slow进环的时候,fast一定是先进环来了。 如果slow进环入口,fast也在环入口,那么把这个环展开成直线,就是如下图的样子: -![142环形链表3](https://code-thinking-1253855093.file.myqcloud.com/pics/2021031816503266.png) +![142环形链表3](https://file.kamacoder.com/pics/2021031816503266.png) 可以看出如果slow 和 fast同时在环入口开始走,一定会在环入口3相遇,slow走了一圈,fast走了两圈。 重点来了,slow进环的时候,fast一定是在环的任意一个位置,如图: -![142环形链表4](https://code-thinking-1253855093.file.myqcloud.com/pics/2021031816515727.png) +![142环形链表4](https://file.kamacoder.com/pics/2021031816515727.png) 那么fast指针走到环入口3的时候,已经走了k + n 个节点,slow相应的应该走了(k + n) / 2 个节点。 diff --git "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" index c61eb4b403..98488bc11d 100644 --- "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" +++ "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" @@ -6,7 +6,7 @@ [力扣题目链接](https://leetcode.cn/problems/reorder-list/submissions/) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210726160122.png) +![](https://file.kamacoder.com/pics/20210726160122.png) ## 思路 diff --git "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" index b182d4d03d..a3fc7ef126 100644 --- "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" +++ "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" @@ -132,7 +132,7 @@ for (int j = 1; j < 2 * k; j += 2) { 以输入[1,2,3,4,5],k=2为例。 -![188.买卖股票的最佳时机IV](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229100358221.png) +![188.买卖股票的最佳时机IV](https://file.kamacoder.com/pics/20201229100358221.png) 最后一次卖出,一定是利润最大的,dp[prices.size() - 1][2 * k]即红色部分就是最后求解。 diff --git "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" index 3d06c95241..0bee40f7cd 100644 --- "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" +++ "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" @@ -87,7 +87,7 @@ for (int i = 2; i < nums.size(); i++) { 以示例二,输入[2,7,9,3,1]为例。 -![198.打家劫舍](https://code-thinking-1253855093.file.myqcloud.com/pics/20210221170954115.jpg) +![198.打家劫舍](https://file.kamacoder.com/pics/20210221170954115.jpg) 红框dp[nums.size() - 1]为结果。 diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" index 4901934bfe..9ea47329bb 100644 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" @@ -13,7 +13,7 @@ 此外,你可以假设该网格的四条边均被水包围。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726093256.png) +![](https://file.kamacoder.com/pics/20220726093256.png) 提示: @@ -28,7 +28,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 @@ -48,7 +48,7 @@ 如果从队列拿出节点,再去标记这个节点走过,就会发生下图所示的结果,会导致很多节点重复加入队列。 -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220727100846.png) +![图二](https://file.kamacoder.com/pics/20220727100846.png) 超时写法 (从队列中取出节点再标记) diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" index a3f6f48c76..a015399859 100644 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" @@ -12,7 +12,7 @@ 此外,你可以假设该网格的四条边均被水包围。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726093256.png) +![](https://file.kamacoder.com/pics/20220726093256.png) 提示: @@ -27,7 +27,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 diff --git "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" index 9a38aaa152..5ecf89bf19 100644 --- "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" +++ "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" @@ -34,11 +34,11 @@ 这里以链表 1 4 2 4 来举例,移除元素4。 -![203_链表删除元素1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210316095351161.png) +![203_链表删除元素1](https://file.kamacoder.com/pics/20210316095351161.png) 如果使用C,C++编程语言的话,不要忘了还要从内存中删除这两个移除的节点, 清理节点内存之后如图: -![203_链表删除元素2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210316095418280.png) +![203_链表删除元素2](https://file.kamacoder.com/pics/20210316095418280.png) **当然如果使用java ,python的话就不用手动管理内存了。** @@ -56,16 +56,16 @@ 来看第一种操作:直接使用原来的链表来进行移除。 -![203_链表删除元素3](https://code-thinking-1253855093.file.myqcloud.com/pics/2021031609544922.png) +![203_链表删除元素3](https://file.kamacoder.com/pics/2021031609544922.png) 移除头结点和移除其他节点的操作是不一样的,因为链表的其他节点都是通过前一个节点来移除当前节点,而头结点没有前一个节点。 所以头结点如何移除呢,其实只要将头结点向后移动一位就可以,这样就从链表中移除了一个头结点。 -![203_链表删除元素4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210316095512470.png) +![203_链表删除元素4](https://file.kamacoder.com/pics/20210316095512470.png) 依然别忘将原头结点从内存中删掉。 -![203_链表删除元素5](https://code-thinking-1253855093.file.myqcloud.com/pics/20210316095543775.png) +![203_链表删除元素5](https://file.kamacoder.com/pics/20210316095543775.png) 这样移除了一个头结点,是不是发现,在单链表中移除头结点 和 移除其他节点的操作方式是不一样,其实在写代码的时候也会发现,需要单独写一段逻辑来处理移除头结点的情况。 @@ -76,7 +76,7 @@ 来看看如何设置一个虚拟头。依然还是在这个链表中,移除元素1。 -![203_链表删除元素6](https://code-thinking-1253855093.file.myqcloud.com/pics/20210316095619221.png) +![203_链表删除元素6](https://file.kamacoder.com/pics/20210316095619221.png) 这里来给链表添加一个虚拟头结点为新的头结点,此时要移除这个旧头结点元素1。 diff --git "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" index 7509882f08..4e33342a67 100644 --- "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" +++ "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" @@ -27,7 +27,7 @@ 其实只需要改变链表的next指针的指向,直接将链表反转 ,而不用重新定义一个新的链表,如图所示: -![206_反转链表](https://code-thinking-1253855093.file.myqcloud.com/pics/20210218090901207.png) +![206_反转链表](https://file.kamacoder.com/pics/20210218090901207.png) 之前链表的头节点是元素1, 反转之后头结点就是元素5 ,这里并没有添加或者删除节点,仅仅是改变next指针的方向。 diff --git "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" index 43a3cb6a2b..ca24bc4234 100644 --- "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" @@ -104,7 +104,7 @@ public: 解题的关键在于 窗口的起始位置如何移动,如图所示: -![leetcode_209](https://code-thinking-1253855093.file.myqcloud.com/pics/20210312160441942.png) +![leetcode_209](https://file.kamacoder.com/pics/20210312160441942.png) 可以发现**滑动窗口的精妙之处在于根据当前子序列和大小的情况,不断调节子序列的起始位置。从而将O(n^2)暴力解法降为O(n)。** diff --git "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" index 536e1e89b8..8fceb0a91e 100644 --- "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" +++ "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" @@ -42,15 +42,15 @@ * 情况一:考虑不包含首尾元素 -![213.打家劫舍II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160748643-20230310134000692.jpg) +![213.打家劫舍II](https://file.kamacoder.com/pics/20210129160748643-20230310134000692.jpg) * 情况二:考虑包含首元素,不包含尾元素 -![213.打家劫舍II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160821374-20230310134003961.jpg) +![213.打家劫舍II1](https://file.kamacoder.com/pics/20210129160821374-20230310134003961.jpg) * 情况三:考虑包含尾元素,不包含首元素 -![213.打家劫舍II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160842491-20230310134008133.jpg) +![213.打家劫舍II2](https://file.kamacoder.com/pics/20210129160842491-20230310134008133.jpg) **注意我这里用的是"考虑"**,例如情况三,虽然是考虑包含尾元素,但不一定要选尾部元素! 对于情况三,取nums[1] 和 nums[3]就是最大的。 diff --git "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" index 3dbd676a8d..e23be78d5e 100644 --- "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" +++ "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" @@ -45,7 +45,7 @@ 选取过程如图: -![216.组合总和III](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195717975.png) +![216.组合总和III](https://file.kamacoder.com/pics/20201123195717975.png) 图中,可以看出,只有最后取到集合(1,3)和为4 符合条件。 @@ -108,7 +108,7 @@ if (path.size() == k) { 本题和[77. 组合](https://programmercarl.com/0077.组合.html)区别之一就是集合固定的就是9个数[1,...,9],所以for循环固定i<=9 如图: -![216.组合总和III](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123195717975-20230310113546003.png) +![216.组合总和III](https://file.kamacoder.com/pics/20201123195717975-20230310113546003.png) 处理过程就是 path收集每次选取的元素,相当于树型结构里的边,sum来统计path里元素的总和。 @@ -166,7 +166,7 @@ public: 这道题目,剪枝操作其实是很容易想到了,想必大家看上面的树形图的时候已经想到了。 如图: -![216.组合总和III1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020112319580476.png) +![216.组合总和III1](https://file.kamacoder.com/pics/2020112319580476.png) 已选元素总和如果已经大于n(图中数值为4)了,那么往后遍历就没有意义了,直接剪掉。 diff --git "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" index 9b649d7be8..37ae7819aa 100644 --- "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" +++ "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" @@ -153,7 +153,7 @@ public: 我来举一个典型的例子如题: - + 完全二叉树只有两种情况,情况一:就是满二叉树,情况二:最后一层叶子节点没有满。 @@ -162,10 +162,10 @@ public: 对于情况二,分别递归左孩子,和右孩子,递归到某一深度一定会有左孩子或者右孩子为满二叉树,然后依然可以按照情况1来计算。 完全二叉树(一)如图: -![222.完全二叉树的节点个数](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124092543662.png) +![222.完全二叉树的节点个数](https://file.kamacoder.com/pics/20201124092543662.png) 完全二叉树(二)如图: -![222.完全二叉树的节点个数1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124092634138.png) +![222.完全二叉树的节点个数1](https://file.kamacoder.com/pics/20201124092634138.png) 可以看出如果整个树不是满二叉树,就递归其左右孩子,直到遇到满二叉树为止,用公式计算这个子树(满二叉树)的节点数量。 @@ -173,15 +173,15 @@ public: 在完全二叉树中,如果递归向左遍历的深度等于递归向右遍历的深度,那说明就是满二叉树。如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829163554.png) +![](https://file.kamacoder.com/pics/20220829163554.png) 在完全二叉树中,如果递归向左遍历的深度不等于递归向右遍历的深度,则说明不是满二叉树,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829163709.png) +![](https://file.kamacoder.com/pics/20220829163709.png) 那有录友说了,这种情况,递归向左遍历的深度等于递归向右遍历的深度,但也不是满二叉树,如题: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829163811.png) +![](https://file.kamacoder.com/pics/20220829163811.png) 如果这么想,大家就是对 完全二叉树理解有误区了,**以上这棵二叉树,它根本就不是一个完全二叉树**! diff --git "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" index 0980e6004c..248a28a4d5 100644 --- "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" @@ -10,7 +10,7 @@ 翻转一棵二叉树。 -![226.翻转二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203192644329.png) +![226.翻转二叉树](https://file.kamacoder.com/pics/20210203192644329.png) 这道题目背后有一个让程序员心酸的故事,听说 Homebrew的作者Max Howell,就是因为没在白板上写出翻转二叉树,最后被Google拒绝了。(真假不做判断,全当一个乐子哈) @@ -35,7 +35,7 @@ 如果要从整个树来看,翻转还真的挺复杂,整个树以中间分割线进行翻转,如图: -![226.翻转二叉树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210203192724351.png) +![226.翻转二叉树1](https://file.kamacoder.com/pics/20210203192724351.png) 可以发现想要翻转它,其实就把每一个节点的左右孩子交换一下就可以了。 diff --git "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" index c5eb603a0d..98cc5b7da8 100644 --- "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -14,7 +14,7 @@ 例如,给定如下二叉搜索树:  root = [6,2,8,0,4,7,9,null,null,3,5] -![235. 二叉搜索树的最近公共祖先](https://code-thinking-1253855093.file.myqcloud.com/pics/20201018172243602.png) +![235. 二叉搜索树的最近公共祖先](https://file.kamacoder.com/pics/20201018172243602.png) 示例 1: @@ -52,7 +52,7 @@ 如图,我们从根节点搜索,第一次遇到 cur节点是数值在[q, p]区间中,即 节点5,此时可以说明 q 和 p 一定分别存在于 节点 5的左子树,和右子树中。 -![235.二叉搜索树的最近公共祖先](https://code-thinking-1253855093.file.myqcloud.com/pics/20220926164214.png) +![235.二叉搜索树的最近公共祖先](https://file.kamacoder.com/pics/20220926164214.png) 此时节点5是不是最近公共祖先? 如果 从节点5继续向左遍历,那么将错过成为p的祖先, 如果从节点5继续向右遍历则错过成为q的祖先。 @@ -64,7 +64,7 @@ 如图所示:p为节点6,q为节点9 -![235.二叉搜索树的最近公共祖先2](https://code-thinking-1253855093.file.myqcloud.com/pics/20220926165141.png) +![235.二叉搜索树的最近公共祖先2](https://file.kamacoder.com/pics/20220926165141.png) 可以看出直接按照指定的方向,就可以找到节点8,为最近公共祖先,而且不需要遍历整棵树,找到结果直接返回! diff --git "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" index f15d1cff60..537d624084 100644 --- "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -16,7 +16,7 @@ 例如,给定如下二叉树:  root = [3,5,1,6,2,0,8,null,null,7,4] -![236. 二叉树的最近公共祖先](https://code-thinking-1253855093.file.myqcloud.com/pics/20201016173414722.png) +![236. 二叉树的最近公共祖先](https://file.kamacoder.com/pics/20201016173414722.png) 示例 1: 输入: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1 @@ -51,7 +51,7 @@ **首先最容易想到的一个情况:如果找到一个节点,发现左子树出现结点p,右子树出现节点q,或者 左子树出现结点q,右子树出现节点p,那么该节点就是节点p和q的最近公共祖先。** 即情况一: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220922173502.png) +![](https://file.kamacoder.com/pics/20220922173502.png) 判断逻辑是 如果递归遍历遇到q,就将q返回,遇到p 就将p返回,那么如果 左右子树的返回值都不为空,说明此时的中节点,一定是q 和p 的最近祖先。 @@ -61,7 +61,7 @@ **但是很多人容易忽略一个情况,就是节点本身p(q),它拥有一个子孙节点q(p)。** 情况二: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220922173530.png) +![](https://file.kamacoder.com/pics/20220922173530.png) 其实情况一 和 情况二 代码实现过程都是一样的,也可以说,实现情况一的逻辑,顺便包含了情况二。 @@ -129,7 +129,7 @@ left与right的逻辑处理; // 中 如图: -![236.二叉树的最近公共祖先](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020415105872.png) +![236.二叉树的最近公共祖先](https://file.kamacoder.com/pics/2021020415105872.png) 就像图中一样直接返回7。 @@ -162,7 +162,7 @@ TreeNode* right = lowestCommonAncestor(root->right, p, q); 如图: -![236.二叉树的最近公共祖先1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204151125844.png) +![236.二叉树的最近公共祖先1](https://file.kamacoder.com/pics/20210204151125844.png) 图中节点10的左子树返回null,右子树返回目标值7,那么此时节点10的处理逻辑就是把右子树的返回值(最近公共祖先7)返回上去! @@ -183,7 +183,7 @@ else { // (left == NULL && right == NULL) 那么寻找最小公共祖先,完整流程图如下: -![236.二叉树的最近公共祖先2](https://code-thinking-1253855093.file.myqcloud.com/pics/202102041512582.png) +![236.二叉树的最近公共祖先2](https://file.kamacoder.com/pics/202102041512582.png) **从图中,大家可以看到,我们是如何回溯遍历整棵二叉树,将结果返回给头结点的!** diff --git "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" index 287db20937..5d71351172 100644 --- "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" +++ "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" @@ -14,7 +14,7 @@ 说明: 叶子节点是指没有子节点的节点。 示例: -![257.二叉树的所有路径1](https://code-thinking-1253855093.file.myqcloud.com/pics/2021020415161576.png) +![257.二叉树的所有路径1](https://file.kamacoder.com/pics/2021020415161576.png) ## 算法公开课 @@ -28,7 +28,7 @@ 前序遍历以及回溯的过程如图: -![257.二叉树的所有路径](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204151702443.png) +![257.二叉树的所有路径](https://file.kamacoder.com/pics/20210204151702443.png) 我们先使用递归的方式,来做前序遍历。**要知道递归和回溯就是一家的,本题也需要回溯。** @@ -315,7 +315,7 @@ public: 其实关键还在于 参数,使用的是 `string path`,这里并没有加上引用`&` ,即本层递归中,path + 该节点数值,但该层递归结束,上一层path的数值并不会受到任何影响。 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220831173322.png) +![](https://file.kamacoder.com/pics/20220831173322.png) 节点4 的path,在遍历到节点3,path+3,遍历节点3的递归结束之后,返回节点4(回溯的过程),path并不会把3加上。 diff --git "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" index c1077bd43d..8171a409a0 100644 --- "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" +++ "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" @@ -93,7 +93,7 @@ for (int i = 0; i <= n; i++) { // 遍历背包 已输入n为5例,dp状态图如下: -![279.完全平方数](https://code-thinking-1253855093.file.myqcloud.com/pics/20210202112617341.jpg) +![279.完全平方数](https://file.kamacoder.com/pics/20210202112617341.jpg) dp[0] = 0 dp[1] = min(dp[0] + 1) = 1 diff --git "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" index 7d2e488623..de37ed5cc8 100644 --- "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" @@ -85,7 +85,7 @@ for (int i = 1; i < nums.size(); i++) { 输入:[0,1,0,3,2],dp数组的变化如下: -![300.最长上升子序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110170945618.jpg) +![300.最长上升子序列](https://file.kamacoder.com/pics/20210110170945618.jpg) 如果代码写出来,但一直AC不了,那么就把dp数组打印出来,看看对不对! diff --git "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" index 6a81933505..599a1f42e1 100644 --- "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" +++ "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" @@ -47,7 +47,7 @@ dp[i][j],第i天状态为j,所剩的最多现金为dp[i][j]。 * 状态三:今天卖出股票 * 状态四:今天为冷冻期状态,但冷冻期状态不可持续,只有一天! -![](https://code-thinking-1253855093.file.myqcloud.com/pics/518d5baaf33f4b2698064f8efb42edbf.png) +![](https://file.kamacoder.com/pics/518d5baaf33f4b2698064f8efb42edbf.png) j的状态为: @@ -136,7 +136,7 @@ dp[i][3] = dp[i - 1][2]; 以 [1,2,3,0,2] 为例,dp数组如下: -![309.最佳买卖股票时机含冷冻期](https://code-thinking-1253855093.file.myqcloud.com/pics/2021032317451040.png) +![309.最佳买卖股票时机含冷冻期](https://file.kamacoder.com/pics/2021032317451040.png) 最后结果是取 状态二,状态三,和状态四的最大值,不少同学会把状态四忘了,状态四是冷冻期,最后一天如果是冷冻期也可能是最大值。 diff --git "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" index dea77a3d10..7f3bc1e4b1 100644 --- "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" +++ "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" @@ -104,7 +104,7 @@ dp[0] = 0; 以输入:coins = [1, 2, 5], amount = 5为例 -![322.零钱兑换](https://code-thinking-1253855093.file.myqcloud.com/pics/20210201111833906.jpg) +![322.零钱兑换](https://file.kamacoder.com/pics/20210201111833906.jpg) dp[amount]为最终结果。 diff --git "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" index f1df25229d..fcdb6a33ed 100644 --- "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" +++ "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" @@ -57,7 +57,7 @@ 对于死循环,我来举一个有重复机场的例子: -![332.重新安排行程](https://code-thinking-1253855093.file.myqcloud.com/pics/20201115180537865.png) +![332.重新安排行程](https://file.kamacoder.com/pics/20201115180537865.png) 为什么要举这个例子呢,就是告诉大家,出发机场和到达机场也会重复的,**如果在解题的过程中没有对集合元素处理好,就会死循环。** @@ -111,7 +111,7 @@ void backtracking(参数) { 本题以输入:[["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]为例,抽象为树形结构如下: -![332.重新安排行程1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111518065555-20230310121223600.png) +![332.重新安排行程1](https://file.kamacoder.com/pics/2020111518065555-20230310121223600.png) 开始回溯三部曲讲解: @@ -137,7 +137,7 @@ bool backtracking(int ticketNum, vector& result) { 因为我们只需要找到一个行程,就是在树形结构中唯一的一条通向叶子节点的路线,如图: -![332.重新安排行程1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111518065555-20230310121240991.png) +![332.重新安排行程1](https://file.kamacoder.com/pics/2020111518065555-20230310121240991.png) 所以找到了这个叶子节点了直接返回,这个递归函数的返回值问题我们在讲解二叉树的系列的时候,在这篇[二叉树:递归函数究竟什么时候需要返回值,什么时候不要返回值?](https://programmercarl.com/0112.路径总和.html)详细介绍过。 diff --git "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" index 08728e4faf..4916af4c26 100644 --- "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" +++ "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" @@ -12,7 +12,7 @@ 计算在不触动警报的情况下,小偷一晚能够盗取的最高金额。 -![337.打家劫舍III](https://code-thinking-1253855093.file.myqcloud.com/pics/20210223173849619.png) +![337.打家劫舍III](https://file.kamacoder.com/pics/20210223173849619.png) ## 算法公开课 @@ -177,7 +177,7 @@ return {val2, val1}; 以示例1为例,dp数组状态如下:(**注意用后序遍历的方式推导**) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230203110031.png) +![](https://file.kamacoder.com/pics/20230203110031.png) **最后头结点就是 取下标0 和 下标1的最大值就是偷得的最大金钱**。 diff --git "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" index 06549185a3..203c422879 100644 --- "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" +++ "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" @@ -127,7 +127,7 @@ for (int i = 3; i <= n ; i++) { 举例当n为10 的时候,dp数组里的数值,如下: -![343.整数拆分](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104173021581.png) +![343.整数拆分](https://file.kamacoder.com/pics/20210104173021581.png) 以上动规五部曲分析完毕,C++代码如下: diff --git "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" index 5066bff1b9..65d22a809c 100644 --- "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" +++ "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" @@ -14,7 +14,7 @@ 题意:给定两个数组,编写一个函数来计算它们的交集。 -![349. 两个数组的交集](https://code-thinking-1253855093.file.myqcloud.com/pics/20200818193523911.png) +![349. 两个数组的交集](https://file.kamacoder.com/pics/20200818193523911.png) **说明:** 输出结果中的每个元素一定是唯一的。 @@ -51,7 +51,7 @@ std::set和std::multiset底层实现都是红黑树,std::unordered_set的底 思路如图所示: -![set哈希法](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707173513.png) +![set哈希法](https://file.kamacoder.com/pics/20220707173513.png) C++代码如下: diff --git "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" index 886d86aefe..50934981a6 100644 --- "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" +++ "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" @@ -46,7 +46,7 @@ 用示例二来举例,如图所示: -![376.摆动序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124174327597.png) +![376.摆动序列](https://file.kamacoder.com/pics/20201124174327597.png) **局部最优:删除单调坡度上的节点(不包括单调坡度两端的节点),那么这个坡度就可以有两个局部峰值**。 @@ -72,13 +72,13 @@ 例如 [1,2,2,2,2,1]这样的数组,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230106170449.png) +![](https://file.kamacoder.com/pics/20230106170449.png) 它的摇摆序列长度是多少呢? **其实是长度是 3**,也就是我们在删除的时候 要不删除左面的三个 2,要不就删除右边的三个 2。 如图,可以统一规则,删除左边的三个 2: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230106172613.png) +![](https://file.kamacoder.com/pics/20230106172613.png) 在图中,当 i 指向第一个 2 的时候,`prediff > 0 && curdiff = 0` ,当 i 指向最后一个 2 的时候 `prediff = 0 && curdiff < 0`。 @@ -106,7 +106,7 @@ 那么为了规则统一,针对序列[2,5],可以假设为[2,2,5],这样它就有坡度了即 preDiff = 0,如图: -![376.摆动序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124174357612.png) +![376.摆动序列1](https://file.kamacoder.com/pics/20201124174357612.png) 针对以上情形,result 初始为 1(默认最右面有一个峰值),此时 curDiff > 0 && preDiff <= 0,那么 result++(计算了左面的峰值),最后得到的 result 就是 2(峰值个数为 2 即摆动序列长度为 2) @@ -145,7 +145,7 @@ public: 在版本一中,我们忽略了一种情况,即 如果在一个单调坡度上有平坡,例如[1,2,2,2,3,4],如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230108171505.png) +![](https://file.kamacoder.com/pics/20230108171505.png) 图中,我们可以看出,版本一的代码在三个地方记录峰值,但其实结果因为是 2,因为 单调中的平坡 不能算峰值(即摆动)。 @@ -184,7 +184,7 @@ public: **本题异常情况的本质,就是要考虑平坡**, 平坡分两种,一个是 上下中间有平坡,一个是单调有平坡,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230108174452.png) +![](https://file.kamacoder.com/pics/20230108174452.png) ### 思路 2(动态规划) diff --git "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" index d2feb0c5d6..20a94331c4 100644 --- "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" +++ "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" @@ -103,7 +103,7 @@ dp[i](考虑nums[j])可以由 dp[i - nums[j]](不考虑nums[j]) 推导 我们再来用示例中的例子推导一下: -![377.组合总和Ⅳ](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000625.png) +![377.组合总和Ⅳ](https://file.kamacoder.com/pics/20230310000625.png) 如果代码运行处的结果不是想要的结果,就把dp[i]都打出来,看看和我们推导的一不一样。 diff --git "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" index 2a5be51c59..d59b7bc121 100644 --- "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" @@ -80,7 +80,7 @@ if (s[i - 1] != t[j - 1]),此时相当于t要删除元素,t如果把当前 因为这样的定义在dp二维矩阵中可以留出初始化的区间,如图: -![392.判断子序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20210303173115966.png) +![392.判断子序列](https://file.kamacoder.com/pics/20210303173115966.png) 如果要是定义的dp[i][j]是以下标i为结尾的字符串s和以下标j为结尾的字符串t,初始化就比较麻烦了。 @@ -98,14 +98,14 @@ vector> dp(s.size() + 1, vector(t.size() + 1, 0)); 如图所示: -![392.判断子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210303172354155.jpg) +![392.判断子序列1](https://file.kamacoder.com/pics/20210303172354155.jpg) 5. 举例推导dp数组 以示例一为例,输入:s = "abc", t = "ahbgdc",dp状态转移图如下: -![392.判断子序列2](https://code-thinking-1253855093.file.myqcloud.com/pics/2021030317364166.jpg) +![392.判断子序列2](https://file.kamacoder.com/pics/2021030317364166.jpg) dp[i][j]表示以下标i-1为结尾的字符串s和以下标j-1为结尾的字符串t 相同子序列的长度,所以如果dp[s.size()][t.size()] 与 字符串s的长度相同说明:s与t的最长相同子序列就是s,那么s 就是 t 的子序列。 diff --git "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" index 0efdb6f663..69723815a1 100644 --- "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" +++ "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" @@ -12,7 +12,7 @@ 示例: -![404.左叶子之和1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204151927654.png) +![404.左叶子之和1](https://file.kamacoder.com/pics/20210204151927654.png) ## 算法公开课 @@ -26,12 +26,12 @@ 大家思考一下如下图中二叉树,左叶子之和究竟是多少? -![404.左叶子之和](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204151949672.png) +![404.左叶子之和](https://file.kamacoder.com/pics/20210204151949672.png) **其实是0,因为这棵树根本没有左叶子!** 但看这个图的左叶子之和是多少? -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220902165805.png) +![图二](https://file.kamacoder.com/pics/20220902165805.png) 相信通过这两个图,大家对最左叶子的定义有明确理解了。 diff --git "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" index 11853e1170..0d060ee837 100644 --- "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" +++ "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" @@ -61,7 +61,7 @@ 以图中{5,2} 为例: -![406.根据身高重建队列](https://code-thinking-1253855093.file.myqcloud.com/pics/20201216201851982.png) +![406.根据身高重建队列](https://file.kamacoder.com/pics/20201216201851982.png) 按照身高排序之后,优先按身高高的people的k来插入,后序插入节点也不会影响前面已经插入的节点,最终按照k的规则完成了队列。 diff --git "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" index 9cc6db0e4b..79b4d4f75a 100644 --- "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" +++ "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" @@ -155,7 +155,7 @@ dp[j]的数值一定是小于等于j的。 用例1,输入[1,5,11,5] 为例,如图: -![416.分割等和子集2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110104240545.png) +![416.分割等和子集2](https://file.kamacoder.com/pics/20210110104240545.png) 最后dp[11] == 11,说明可以将这个数组分割成两个子集,使得两个子集的元素和相等。 diff --git "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" index ec87eb9595..116cd08e09 100644 --- "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" +++ "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" @@ -18,7 +18,7 @@ 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230129103212.png) +![](https://file.kamacoder.com/pics/20230129103212.png) * 输入: heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]] * 输出: [[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]] @@ -130,11 +130,11 @@ public: 从太平洋边上节点出发,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220722103029.png) +![图一](https://file.kamacoder.com/pics/20220722103029.png) 从大西洋边上节点出发,如图: -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220722103330.png) +![图二](https://file.kamacoder.com/pics/20220722103330.png) 按照这样的逻辑,就可以写出如下遍历代码:(详细注释) diff --git "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" index a37d1cadac..04845ea7c3 100644 --- "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" +++ "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" @@ -44,7 +44,7 @@ 这里记录非交叉区间的个数还是有技巧的,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230201164134.png) +![](https://file.kamacoder.com/pics/20230201164134.png) 区间,1,2,3,4,5,6都按照右边界排好序。 diff --git "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" index 7280918460..406116a388 100644 --- "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" +++ "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" @@ -20,7 +20,7 @@ 示例: -![450.删除二叉搜索树中的节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20201020171048265.png) +![450.删除二叉搜索树中的节点](https://file.kamacoder.com/pics/20201020171048265.png) ## 算法公开课 diff --git "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" index 854498829b..17d21cd1c4 100644 --- "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" +++ "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" @@ -76,7 +76,7 @@ 以题目示例: [[10,16],[2,8],[1,6],[7,12]]为例,如图:(方便起见,已经排序) -![452.用最少数量的箭引爆气球](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123101929791.png) +![452.用最少数量的箭引爆气球](https://file.kamacoder.com/pics/20201123101929791.png) 可以看出首先第一组重叠气球,一定是需要一个箭,气球3,的左边界大于了 第一组重叠气球的最小右边界,所以再需要一支箭来射气球3了。 diff --git "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" index a2a1b1f339..2a6ade1b64 100644 --- "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" +++ "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" @@ -46,7 +46,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230405225628.png) +![](https://file.kamacoder.com/pics/20230405225628.png) 这个例子可以看出饼干 9 只有喂给胃口为 7 的小孩,这样才是整体最优解,并想不出反例,那么就可以撸代码了。 @@ -89,7 +89,7 @@ public: 如果 for 控制的是饼干, if 控制胃口,就是出现如下情况 : -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230112102848.png) +![](https://file.kamacoder.com/pics/20230112102848.png) if 里的 index 指向 胃口 10, for 里的 i 指向饼干 9,因为 饼干 9 满足不了 胃口 10,所以 i 持续向前移动,而 index 走不到` s[index] >= g[i]` 的逻辑,所以 index 不会移动,那么当 i 持续向前移动,最后所有的饼干都匹配不上。 diff --git "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" index 78aad3e786..627a27a48e 100644 --- "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" @@ -46,13 +46,13 @@ 当一个字符串s:abcabc,内部由重复的子串组成,那么这个字符串的结构一定是这样的: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220728104518.png) +![图一](https://file.kamacoder.com/pics/20220728104518.png) 也就是由前后相同的子串组成。 那么既然前面有相同的子串,后面有相同的子串,用 s + s,这样组成的字符串中,后面的子串做前串,前面的子串做后串,就一定还能组成一个s,如图: -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220728104931.png) +![图二](https://file.kamacoder.com/pics/20220728104931.png) 当然,我们在判断 s + s 拼接的字符串里是否出现一个s的的时候,**要刨除 s + s 的首字符和尾字符**,这样避免在s+s中搜索出原来的s,我们要搜索的是中间拼接出来的s。 @@ -64,11 +64,11 @@ 如图,字符串s,图中数字为数组下标,在 s + s 拼接后, 不算首尾字符,中间凑成s字符串。 (图中数字为数组下标) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910115555.png) +![](https://file.kamacoder.com/pics/20240910115555.png) 图中,因为中间拼接成了s,根据红色框 可以知道 s[4] = s[0], s[5] = s[1], s[0] = s[2], s[1] = s[3] s[2] = s[4] ,s[3] = s[5] -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910115819.png) +![](https://file.kamacoder.com/pics/20240910115819.png) 以上相等关系我们串联一下: @@ -83,7 +83,7 @@ s[5] = s[1] = s[3] 这里可以有录友想,凭什么就是这样组成的s呢,我换一个方式组成s 行不行,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910120751.png) +![](https://file.kamacoder.com/pics/20240910120751.png) s[3] = s[0],s[4] = s[1] ,s[5] = s[2],s[0] = s[3],s[1] = s[4],s[2] = s[5] @@ -101,7 +101,7 @@ s[0] s[1] s[2] = s[3] s[4] s[5] 如果是这样的呢,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910121236.png) +![](https://file.kamacoder.com/pics/20240910121236.png) s[1] = s[0],s[2] = s[1] ,s[3] = s[2],s[4] = s[3],s[5] = s[4],s[0] = s[5] @@ -165,23 +165,23 @@ KMP算法中next数组为什么遇到字符不匹配的时候可以找到上一 那么相同前后缀可以是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913110257.png) +![](https://file.kamacoder.com/pics/20240913110257.png) 也可以是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913110316.png) +![](https://file.kamacoder.com/pics/20240913110316.png) 最长的相等前后缀,也就是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913110841.png) +![](https://file.kamacoder.com/pics/20240913110841.png) 这里有录友就想:如果字符串s 是由最小重复子串p组成,最长相等前后缀就不能更长一些? 例如这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913114348.png) +![](https://file.kamacoder.com/pics/20240913114348.png) 如果这样的话,因为前后缀要相同,所以 p2 = p1,p3 = p2,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913114818.png) +![](https://file.kamacoder.com/pics/20240913114818.png) p2 = p1,p3 = p2 即: p1 = p2 = p3 @@ -203,7 +203,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 情况一, 最长相等前后缀不包含的子串的长度 比 字符串s的一半的长度还大,那一定不是字符串s的重复子串,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240911110236.png) +![](https://file.kamacoder.com/pics/20240911110236.png) 图中:前后缀不包含的子串的长度 大于 字符串s的长度的 二分之一 @@ -211,7 +211,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 情况二,最长相等前后缀不包含的子串的长度 可以被 字符串s的长度整除,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910174249.png) +![](https://file.kamacoder.com/pics/20240910174249.png) 步骤一:因为 这是相等的前缀和后缀,t[0] 与 k[0]相同, t[1] 与 k[1]相同,所以 s[0] 一定和 s[2]相同,s[1] 一定和 s[3]相同,即:,s[0]s[1]与s[2]s[3]相同 。 @@ -234,7 +234,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 那么它的最长相同前后缀,就不是上图中的前后缀,而是这样的的前后缀: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240910175053.png) +![](https://file.kamacoder.com/pics/20240910175053.png) 录友可能再问,由一个字符组成的字符串,最长相等前后缀凭什么就是这样的。 @@ -250,7 +250,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 **情况三,最长相等前后缀不包含的子串的长度 不被 字符串s的长度整除得情况**,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240913115854.png) +![](https://file.kamacoder.com/pics/20240913115854.png) 步骤一:因为 这是相等的前缀和后缀,t[0] 与 k[0]相同, t[1] 与 k[1]相同,t[2] 与 k[2]相同。 diff --git "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" index bff619ccde..40ddc57d63 100644 --- "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" +++ "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" @@ -15,7 +15,7 @@ 岛屿中没有“湖”(“湖” 指水域在岛屿内部且不和岛屿周围的水相连)。格子是边长为 1 的正方形。网格为长方形,且宽度和高度均不超过 100 。计算这个岛屿的周长。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230829180848.png) +![](https://file.kamacoder.com/pics/20230829180848.png) * 输入:grid = [[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]] * 输出:16 diff --git "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" index ca525ab2e3..8166b39aad 100644 --- "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" +++ "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" @@ -51,7 +51,7 @@ 其实本题并不是多重背包,再来看一下这个图,捋清几种背包的关系 -![416.分割等和子集1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210117171307407-20230310132423205.png) +![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407-20230310132423205.png) 多重背包是每个物品,数量不同的情况。 @@ -127,7 +127,7 @@ for (string str : strs) { // 遍历物品 最后dp数组的状态如下所示: -![474.一和零](https://code-thinking-1253855093.file.myqcloud.com/pics/20210120111201512.jpg) +![474.一和零](https://file.kamacoder.com/pics/20210120111201512.jpg) 以上动规五部曲分析完毕,C++代码如下: diff --git "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" index 1b927dd3d2..b3171c8a12 100644 --- "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" @@ -45,7 +45,7 @@ 为了有鲜明的对比,我用[4, 7, 6, 7]这个数组来举例,抽象为树形结构如图: -![491. 递增子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124200229824.png) +![491. 递增子序列1](https://file.kamacoder.com/pics/20201124200229824.png) @@ -79,7 +79,7 @@ if (path.size() > 1) { * 单层搜索逻辑 -![491. 递增子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124200229824-20230310131640070.png) +![491. 递增子序列1](https://file.kamacoder.com/pics/20201124200229824-20230310131640070.png) 在图中可以看出,**同一父节点下的同层上使用过的元素就不能再使用了** 那么单层搜索代码如下: diff --git "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" index bde843ead3..a23e1743cb 100644 --- "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" +++ "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" @@ -163,7 +163,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 先只考虑物品0,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240808161747.png) +![](https://file.kamacoder.com/pics/20240808161747.png) (这里的所有物品,都是题目中的数字1)。 @@ -177,7 +177,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 接下来 考虑 物品0 和 物品1,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240808162052.png) +![](https://file.kamacoder.com/pics/20240808162052.png) 装满背包容量为0 的方法个数是1,即 放0件物品。 @@ -191,7 +191,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 接下来 考虑 物品0 、物品1 和 物品2 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240808162533.png) +![](https://file.kamacoder.com/pics/20240808162533.png) 装满背包容量为0 的方法个数是1,即 放0件物品。 @@ -207,17 +207,17 @@ if (abs(target) > sum) return 0; // 此时没有方案 如图红色部分: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240808163312.png) +![](https://file.kamacoder.com/pics/20240808163312.png) dp[2][2] = 3,即 放物品0 和 放物品1、放物品0 和 物品 2、放物品1 和 物品2, 如图所示,三种方法: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240826111946.png) +![](https://file.kamacoder.com/pics/20240826111946.png) **容量为2 的背包,如果不放 物品2 有几种方法呢**? 有 dp[1][2] 种方法,即 背包容量为2,只考虑物品0 和 物品1 ,有 dp[1][2] 种方法,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240826112805.png) +![](https://file.kamacoder.com/pics/20240826112805.png) **容量为2 的背包, 如果放 物品2 有几种方法呢**? @@ -229,7 +229,7 @@ dp[2][2] = 3,即 放物品0 和 放物品1、放物品0 和 物品 2、放物 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240826113043.png) +![](https://file.kamacoder.com/pics/20240826113043.png) 有录友可能疑惑,这里计算的是放满 容量为2的背包 有几种方法,那物品2去哪了? @@ -239,7 +239,7 @@ dp[2][2] = 容量为2的背包不放物品2有几种方法 + 容量为2的背包 所以 dp[2][2] = dp[1][2] + dp[1][1] ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240826113258.png) +![](https://file.kamacoder.com/pics/20240826113258.png) 以上过程,抽象化如下: @@ -266,11 +266,11 @@ else dp[i][j] = dp[i - 1][j] + dp[i - 1][j - nums[i]]; 先明确递推的方向,如图,求解 dp[2][2] 是由 上方和左上方推出。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240826115800.png) +![](https://file.kamacoder.com/pics/20240826115800.png) 那么二维数组的最上行 和 最左列一定要初始化,这是递推公式推导的基础,如图红色部分: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827103507.png) +![](https://file.kamacoder.com/pics/20240827103507.png) 关于dp[0][0]的值,在上面的递推公式讲解中已经讲过,装满背包容量为0 的方法数量是1,即 放0件物品。 @@ -323,7 +323,7 @@ for (int i = 0; i < nums.size(); i++) { 例如下图,如果上方没数值,左上方没数值,就无法推出 dp[2][2]。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827105427.png) +![](https://file.kamacoder.com/pics/20240827105427.png) 那么是先 从上到下 ,再从左到右遍历,例如这样: @@ -349,11 +349,11 @@ for (int j = 0; j <= bagSize; j++) { // 列,遍历背包 这里我再画图讲一下,以求dp[2][2]为例,当先从上到下,再从左到右遍历,矩阵是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827110933.png) +![](https://file.kamacoder.com/pics/20240827110933.png) 当先从左到右,再从上到下遍历,矩阵是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827111013.png) +![](https://file.kamacoder.com/pics/20240827111013.png) 这里大家可以看出,无论是以上哪种遍历,都不影响 dp[2][2]的求值,用来 推导 dp[2][2] 的数值都在。 @@ -366,7 +366,7 @@ bagSize = (target + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827111612.png) +![](https://file.kamacoder.com/pics/20240827111612.png) 这么大的矩阵,我们是可以自己手动模拟出来的。 @@ -445,7 +445,7 @@ bagSize = (target + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210125120743274.jpg) +![](https://file.kamacoder.com/pics/20210125120743274.jpg) 大家可以和 二维dp数组的打印结果做一下对比。 diff --git "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" index 32a89e859a..8cca8e65c8 100644 --- "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" +++ "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" @@ -23,7 +23,7 @@ 给定 BST [1,null,2,2], -![501. 二叉搜索树中的众数](https://code-thinking-1253855093.file.myqcloud.com/pics/20201014221532206.png) +![501. 二叉搜索树中的众数](https://file.kamacoder.com/pics/20201014221532206.png) 返回[2]. @@ -144,7 +144,7 @@ public: 如图: -![501.二叉搜索树中的众数1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204152758889.png) +![501.二叉搜索树中的众数1](https://file.kamacoder.com/pics/20210204152758889.png) 中序遍历代码如下: diff --git "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" index da37360374..4098cb7bfb 100644 --- "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" +++ "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" @@ -12,11 +12,11 @@ 示例 1: -![513.找树左下角的值](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204152956836.png) +![513.找树左下角的值](https://file.kamacoder.com/pics/20210204152956836.png) 示例 2: -![513.找树左下角的值1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204153017586.png) +![513.找树左下角的值1](https://file.kamacoder.com/pics/20210204153017586.png) ## 算法公开课 diff --git "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" index f0ef2f53d0..5e456ac975 100644 --- "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" @@ -56,7 +56,7 @@ 如果s[i]与s[j]相同,那么dp[i][j] = dp[i + 1][j - 1] + 2; 如图: -![516.最长回文子序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20210127151350563.jpg) +![516.最长回文子序列](https://file.kamacoder.com/pics/20210127151350563.jpg) (如果这里看不懂,回忆一下dp[i][j]的定义) @@ -68,7 +68,7 @@ 那么dp[i][j]一定是取最大的,即:dp[i][j] = max(dp[i + 1][j], dp[i][j - 1]); -![516.最长回文子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210127151420476.jpg) +![516.最长回文子序列1](https://file.kamacoder.com/pics/20210127151420476.jpg) 代码如下: @@ -97,7 +97,7 @@ for (int i = 0; i < s.size(); i++) dp[i][i] = 1; 从递归公式中,可以看出,dp[i][j] 依赖于 dp[i + 1][j - 1] ,dp[i + 1][j] 和 dp[i][j - 1],如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230102172155.png) +![](https://file.kamacoder.com/pics/20230102172155.png) **所以遍历i的时候一定要从下到上遍历,这样才能保证下一行的数据是经过计算的**。 @@ -121,7 +121,7 @@ for (int i = s.size() - 1; i >= 0; i--) { 输入s:"cbbd" 为例,dp数组状态如图: -![516.最长回文子序列3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210127151521432.jpg) +![516.最长回文子序列3](https://file.kamacoder.com/pics/20210127151521432.jpg) 红色框即:dp[0][s.size() - 1]; 为最终结果。 diff --git "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" index 1698db9887..95122a7c95 100644 --- "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" +++ "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" @@ -136,7 +136,7 @@ 那么二维数组的最上行 和 最左列一定要初始化,这是递推公式推导的基础,如图红色部分: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240827103507.png) +![](https://file.kamacoder.com/pics/20240827103507.png) 这里首先要关注的就是 dp[0][0] 应该是多少? @@ -296,7 +296,7 @@ for (int j = 0; j <= amount; j++) { // 遍历背包容量 输入: amount = 5, coins = [1, 2, 5] ,dp状态图如下: -![518.零钱兑换II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210120181331461.jpg) +![518.零钱兑换II](https://file.kamacoder.com/pics/20210120181331461.jpg) 最后红色框dp[amount]为最终结果。 diff --git "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" index d7b0e056db..466bd74479 100644 --- "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" +++ "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" @@ -13,7 +13,7 @@ 示例: -![530二叉搜索树的最小绝对差](https://code-thinking-1253855093.file.myqcloud.com/pics/20201014223400123.png) +![530二叉搜索树的最小绝对差](https://file.kamacoder.com/pics/20201014223400123.png) 提示:树中至少有 2 个节点。 @@ -70,7 +70,7 @@ public: 如图: -![530.二叉搜索树的最小绝对差](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204153247458.png) +![530.二叉搜索树的最小绝对差](https://file.kamacoder.com/pics/20210204153247458.png) 一些同学不知道在递归中如何记录前一个节点的指针,其实实现起来是很简单的,大家只要看过一次,写过一次,就掌握了。 diff --git "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" index 1bbbdac76d..45bf1f96ed 100644 --- "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" +++ "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" @@ -18,7 +18,7 @@ 示例 1: -![538.把二叉搜索树转换为累加树](https://code-thinking-1253855093.file.myqcloud.com/pics/20201023160751832.png) +![538.把二叉搜索树转换为累加树](https://file.kamacoder.com/pics/20201023160751832.png) * 输入:[4,1,6,0,2,5,7,null,null,null,3,null,null,null,8] * 输出:[30,36,21,36,35,26,15,null,null,null,33,null,null,null,8] @@ -67,7 +67,7 @@ 遍历顺序如图所示: -![538.把二叉搜索树转换为累加树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204153440666.png) +![538.把二叉搜索树转换为累加树](https://file.kamacoder.com/pics/20210204153440666.png) 本题依然需要一个pre指针记录当前遍历节点cur的前一个节点,这样才方便做累加。 diff --git "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" index a86dfad195..7f7d30f6a1 100644 --- "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" +++ "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" @@ -81,7 +81,7 @@ for (int j = 0; j <= word2.size(); j++) dp[0][j] = j; 以word1:"sea",word2:"eat"为例,推导dp数组状态图如下: -![583.两个字符串的删除操作1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210714101750205.png) +![583.两个字符串的删除操作1](https://file.kamacoder.com/pics/20210714101750205.png) 以上分析完毕,代码如下: diff --git "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" index f180c4f3b9..755200fe82 100644 --- "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" @@ -13,7 +13,7 @@ 示例 1: -![617.合并二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000854.png) +![617.合并二叉树](https://file.kamacoder.com/pics/20230310000854.png) 注意: 合并必须从两个树的根节点开始。 diff --git "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" index e2783027aa..7282953570 100644 --- "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -48,7 +48,7 @@ dp[i] 和 dp[i-1] ,dp[i + 1] 看上去都没啥关系。 所以我们要看回文串的性质。 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230102170752.png) +![](https://file.kamacoder.com/pics/20230102170752.png) 我们在判断字符串S是否是回文,那么如果我们知道 s[1],s[2],s[3] 这个子串是回文的,那么只需要比较 s[0]和s[4]这两个元素是否相同,如果相同的话,这个字符串s 就是回文串。 @@ -106,7 +106,7 @@ dp[i][j]可以初始化为true么? 当然不行,怎能刚开始就全都匹 dp[i + 1][j - 1] 在 dp[i][j]的左下角,如图: -![647.回文子串](https://code-thinking-1253855093.file.myqcloud.com/pics/20210121171032473-20230310132134822.jpg) +![647.回文子串](https://file.kamacoder.com/pics/20210121171032473-20230310132134822.jpg) 如果这矩阵是从上到下,从左到右遍历,那么会用到没有计算过的dp[i + 1][j - 1],也就是根据不确定是不是回文的区间[i+1,j-1],来判断了[i,j]是不是回文,那结果一定是不对的。 @@ -136,7 +136,7 @@ for (int i = s.size() - 1; i >= 0; i--) { // 注意遍历顺序 举例,输入:"aaa",dp[i][j]状态如下: -![647.回文子串1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210121171059951-20230310132153163.jpg) +![647.回文子串1](https://file.kamacoder.com/pics/20210121171059951-20230310132153163.jpg) 图中有6个true,所以就是有6个回文子串。 diff --git "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" index 9f897a7502..b8841a8bea 100644 --- "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" @@ -17,7 +17,7 @@ 示例 : -![654.最大二叉树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204154534796.png) +![654.最大二叉树](https://file.kamacoder.com/pics/20210204154534796.png) 提示: diff --git "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" index 0a05360bf1..f4ded2c4fb 100644 --- "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -14,9 +14,9 @@ 给定一个二叉搜索树,同时给定最小边界L 和最大边界 R。通过修剪二叉搜索树,使得所有节点的值在[L, R]中 (R>=L) 。你可能需要改变树的根节点,所以结果应当返回修剪好的二叉搜索树的新的根节点。 -![669.修剪二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20201014173115788.png) +![669.修剪二叉搜索树](https://file.kamacoder.com/pics/20201014173115788.png) -![669.修剪二叉搜索树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201014173219142.png) +![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20201014173219142.png) ## 算法公开课 @@ -50,7 +50,7 @@ public: 我们在重新关注一下第二个示例,如图: -![669.修剪二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204155302751.png) +![669.修剪二叉搜索树](https://file.kamacoder.com/pics/20210204155302751.png) **所以以上的代码是不可行的!** @@ -60,7 +60,7 @@ public: 在上图中我们发现节点0并不符合区间要求,那么将节点0的右孩子 节点2 直接赋给 节点3的左孩子就可以了(就是把节点0从二叉树中移除),如图: -![669.修剪二叉搜索树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204155327203.png) +![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20210204155327203.png) 理解了最关键部分了我们再递归三部曲: @@ -127,7 +127,7 @@ return root; 在回顾一下上面的代码,针对下图中二叉树的情况: -![669.修剪二叉搜索树1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204155327203-20230310120126738.png) +![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20210204155327203-20230310120126738.png) 如下代码相当于把节点0的右孩子(节点2)返回给上一层, diff --git "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" index 9bfa91cc94..92009f5b76 100644 --- "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" +++ "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" @@ -178,7 +178,7 @@ for (int i = 0; i < nums.size(); i++) { 输入:[1,3,5,4,7] -![673.最长递增子序列的个数](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000656.png) +![673.最长递增子序列的个数](https://file.kamacoder.com/pics/20230310000656.png) **如果代码写出来了,怎么改都通过不了,那么把dp和count打印出来看看对不对!** diff --git "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" index 2c490c0c5b..16bb2f1887 100644 --- "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" +++ "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" @@ -85,7 +85,7 @@ for (int i = 1; i < nums.size(); i++) { 已输入nums = [1,3,5,4,7]为例,dp数组状态如下: -![674.最长连续递增序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204103529742.jpg) +![674.最长连续递增序列](https://file.kamacoder.com/pics/20210204103529742.jpg) **注意这里要取dp[i]里的最大值,所以dp[2]才是结果!** diff --git "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" index e6d2d8e502..8a7234df52 100644 --- "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" +++ "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" @@ -12,7 +12,7 @@ 请找出一条可以删去的边,删除后可使得剩余部分是一个有着 n 个节点的树。如果有多个答案,则返回数组 edges 中最后出现的边。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727150215.png) +![](https://file.kamacoder.com/pics/20210727150215.png) 提示: * n == edges.length @@ -85,7 +85,7 @@ void join(int u, int v) { 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230604104720.png) +![](https://file.kamacoder.com/pics/20230604104720.png) 节点A 和节点 B 不在同一个集合,那么就可以将两个 节点连在一起。 @@ -95,7 +95,7 @@ void join(int u, int v) { 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230604104330.png) +![](https://file.kamacoder.com/pics/20230604104330.png) 已经判断 节点A 和 节点B 在在同一个集合(同一个根),如果将 节点A 和 节点B 连在一起就一定会出现环。 diff --git "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" index 7b0e320c6f..66f7bfe1bc 100644 --- "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" +++ "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" @@ -16,9 +16,9 @@ 返回一条能删除的边,使得剩下的图是有 n 个节点的有根树。若有多个答案,返回最后出现在给定二维数组的答案。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727151057.png) +![](https://file.kamacoder.com/pics/20210727151057.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727151118.png) +![](https://file.kamacoder.com/pics/20210727151118.png) 提示: diff --git "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" index 0b84e651c1..972a999591 100644 --- "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" +++ "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" @@ -14,7 +14,7 @@ 计算并返回 grid 中最大的岛屿面积。如果没有岛屿,则返回面积为 0 。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220729111528.png) +![](https://file.kamacoder.com/pics/20220729111528.png) * 输入:grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]] * 输出:6 @@ -27,7 +27,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题目也是 dfs bfs基础类题目,就是搜索每个岛屿上“1”的数量,然后取一个最大的。 diff --git "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" index 4225b3fe25..0c373f615b 100644 --- "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" +++ "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" @@ -12,7 +12,7 @@ 例如, -![700.二叉搜索树中的搜索](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204155522476.png) +![700.二叉搜索树中的搜索](https://file.kamacoder.com/pics/20210204155522476.png) 在上述示例中,如果要找的值是 5,但因为没有节点值为 5,我们应该返回 NULL。 @@ -124,7 +124,7 @@ public: 中间节点如果大于3就向左走,如果小于3就向右走,如图: -![二叉搜索树](https://code-thinking-1253855093.file.myqcloud.com/pics/20200812190213280.png) +![二叉搜索树](https://file.kamacoder.com/pics/20200812190213280.png) 所以迭代法代码如下: diff --git "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" index ef383faa86..6ce9ef3371 100644 --- "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" +++ "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" @@ -12,7 +12,7 @@ 注意,可能存在多种有效的插入方式,只要树在插入后仍保持为二叉搜索树即可。 你可以返回任意有效的结果。 -![701.二叉搜索树中的插入操作](https://code-thinking-1253855093.file.myqcloud.com/pics/20201019173259554.png) +![701.二叉搜索树中的插入操作](https://file.kamacoder.com/pics/20201019173259554.png) 提示: diff --git "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" index 405018745e..0ce2f3b8a6 100644 --- "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" +++ "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" @@ -59,7 +59,7 @@ 例如在数组:1,2,3,4,7,9,10中查找元素2,如图所示: -![704.二分查找](https://code-thinking-1253855093.file.myqcloud.com/pics/20210311153055723.jpg) +![704.二分查找](https://file.kamacoder.com/pics/20210311153055723.jpg) 代码如下:(详细注释) @@ -102,7 +102,7 @@ public: 在数组:1,2,3,4,7,9,10中查找元素2,如图所示:(**注意和方法一的区别**) -![704.二分查找1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210311153123632.jpg) +![704.二分查找1](https://file.kamacoder.com/pics/20210311153123632.jpg) 代码如下:(详细注释) diff --git "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" index 7023bd902a..a2b2803b11 100644 --- "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" +++ "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" @@ -20,7 +20,7 @@ * deleteAtIndex(index):如果索引 index 有效,则删除链表中的第 index 个节点。 -![707示例](https://code-thinking-1253855093.file.myqcloud.com/pics/20200814200558953.png) +![707示例](https://file.kamacoder.com/pics/20200814200558953.png) ## 算法公开课 @@ -35,10 +35,10 @@ 如果对链表的虚拟头结点不清楚,可以看这篇文章:[链表:听说用虚拟头节点会方便很多?](https://programmercarl.com/0203.移除链表元素.html) 删除链表节点: -![链表-删除节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806195114541.png) +![链表-删除节点](https://file.kamacoder.com/pics/20200806195114541.png) 添加链表节点: -![链表-添加节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806195134331.png) +![链表-添加节点](https://file.kamacoder.com/pics/20200806195134331.png) 这道题目设计链表的五个接口: * 获取链表第index个节点的数值 diff --git "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" index 0e4b346d82..b371bd857b 100644 --- "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" @@ -95,7 +95,7 @@ for (int i = 1; i <= nums1.size(); i++) { 拿示例1中,A: [1,2,3,2,1],B: [3,2,1,4,7]为例,画一个dp数组的状态变化,如下: -![718.最长重复子数组](https://code-thinking-1253855093.file.myqcloud.com/pics/2021011215282060.jpg) +![718.最长重复子数组](https://file.kamacoder.com/pics/2021011215282060.jpg) 以上五部曲分析完毕,C++代码如下: @@ -127,7 +127,7 @@ public: 在如下图中: -![718.最长重复子数组](https://code-thinking-1253855093.file.myqcloud.com/pics/2021011215282060-20230310134554486.jpg) +![718.最长重复子数组](https://file.kamacoder.com/pics/2021011215282060-20230310134554486.jpg) 我们可以看出dp[i][j]都是由dp[i - 1][j - 1]推出。那么压缩为一维数组,也就是dp[j]都是由dp[j - 1]推出。 diff --git "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" index 542aad29b8..ed43cf141f 100644 --- "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" +++ "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" @@ -69,7 +69,7 @@ 首先先将第一个遍历元素加入单调栈 -![739.每日温度1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124434172.jpg) +![739.每日温度1](https://file.kamacoder.com/pics/20210219124434172.jpg) --------- @@ -77,65 +77,65 @@ 我们要保持一个递增单调栈(从栈头到栈底),所以将T[0]弹出,T[1]加入,此时result数组可以记录了,result[0] = 1,即T[0]右面第一个比T[0]大的元素是T[1]。 -![739.每日温度2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124504299.jpg) +![739.每日温度2](https://file.kamacoder.com/pics/20210219124504299.jpg) ----------- 加入T[2],同理,T[1]弹出 -![739.每日温度3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124527361.jpg) +![739.每日温度3](https://file.kamacoder.com/pics/20210219124527361.jpg) ------- 加入T[3],T[3] < T[2] (当前遍历的元素T[i]小于栈顶元素T[st.top()]的情况),加T[3]加入单调栈。 -![739.每日温度4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124610761.jpg) +![739.每日温度4](https://file.kamacoder.com/pics/20210219124610761.jpg) --------- 加入T[4],T[4] == T[3] (当前遍历的元素T[i]等于栈顶元素T[st.top()]的情况),此时依然要加入栈,不用计算距离,因为我们要求的是右面第一个大于本元素的位置,而不是大于等于! -![739.每日温度5](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124633444.jpg) +![739.每日温度5](https://file.kamacoder.com/pics/20210219124633444.jpg) --------- 加入T[5],T[5] > T[4] (当前遍历的元素T[i]大于栈顶元素T[st.top()]的情况),将T[4]弹出,同时计算距离,更新result -![739.每日温度6](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124700567.jpg) +![739.每日温度6](https://file.kamacoder.com/pics/20210219124700567.jpg) ---------- T[4]弹出之后, T[5] > T[3] (当前遍历的元素T[i]大于栈顶元素T[st.top()]的情况),将T[3]继续弹出,同时计算距离,更新result -![739.每日温度7](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124726613.jpg) +![739.每日温度7](https://file.kamacoder.com/pics/20210219124726613.jpg) ------- 直到发现T[5]小于T[st.top()],终止弹出,将T[5]加入单调栈 -![739.每日温度8](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124807715.jpg) +![739.每日温度8](https://file.kamacoder.com/pics/20210219124807715.jpg) ------- 加入T[6],同理,需要将栈里的T[5],T[2]弹出 -![739.每日温度9](https://code-thinking-1253855093.file.myqcloud.com/pics/2021021912483374.jpg) +![739.每日温度9](https://file.kamacoder.com/pics/2021021912483374.jpg) ------- 同理,继续弹出 -![739.每日温度10](https://code-thinking-1253855093.file.myqcloud.com/pics/2021021912490098.jpg) +![739.每日温度10](https://file.kamacoder.com/pics/2021021912490098.jpg) ------ 此时栈里只剩下了T[6] -![739.每日温度11](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124930156.jpg) +![739.每日温度11](https://file.kamacoder.com/pics/20210219124930156.jpg) ------------ 加入T[7], T[7] < T[6] 直接入栈,这就是最后的情况,result数组也更新完了。 -![739.每日温度12](https://code-thinking-1253855093.file.myqcloud.com/pics/20210219124957216.jpg) +![739.每日温度12](https://file.kamacoder.com/pics/20210219124957216.jpg) 此时有同学可能就疑惑了,那result[6] , result[7]怎么没更新啊,元素也一直在栈里。 diff --git "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" index 6533a240bf..c8a8736151 100644 --- "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" +++ "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" @@ -13,7 +13,7 @@ https://leetcode.cn/problems/network-delay-time/description/ 现在,从某个节点 K 发出一个信号。需要多久才能使所有节点都收到信号?如果不能使所有节点收到信号,返回 -1 。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240229104105.png) +![](https://file.kamacoder.com/pics/20240229104105.png) 提示: @@ -42,7 +42,7 @@ dijkstra算法:在有权图(权值非负数)中求从起点到其他节点 如本题示例中的图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240125162647.png) +![](https://file.kamacoder.com/pics/20240125162647.png) 起点(节点1)到终点(节点7) 的最短路径是 图中 标记绿线的部分。 @@ -88,7 +88,7 @@ minDist数组数值初始化为int最大值。 这里在强点一下 **minDist数组的含义:记录所有节点到源点的最短路径**,那么初始化的时候就应该初始为最大值,这样才能在后续出现最短路径的时候及时更新。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115306.png) +![](https://file.kamacoder.com/pics/20240130115306.png) (图中,max 表示默认值,节点0 不做处理,统一从下标1 开始计算,这样下标和节点数值统一, 方便大家理解,避免搞混) @@ -110,7 +110,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115421.png) +![](https://file.kamacoder.com/pics/20240130115421.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -136,7 +136,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130121240.png) +![](https://file.kamacoder.com/pics/20240130121240.png) 更新 minDist数组,即:源点(节点1) 到 节点6 、 节点3 和 节点4的距离。 @@ -170,7 +170,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130120434.png) +![](https://file.kamacoder.com/pics/20240130120434.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -190,7 +190,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201105335.png) +![](https://file.kamacoder.com/pics/20240201105335.png) 由于节点4的加入,那么源点可以链接到节点5 所以更新minDist数组: @@ -210,7 +210,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110250.png) +![](https://file.kamacoder.com/pics/20240201110250.png) 由于节点6的加入,那么源点可以链接到节点7 所以 更新minDist数组: @@ -230,7 +230,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110651.png) +![](https://file.kamacoder.com/pics/20240201110651.png) 由于节点5的加入,那么源点有新的路径可以链接到节点7 所以 更新minDist数组: @@ -248,7 +248,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110920.png) +![](https://file.kamacoder.com/pics/20240201110920.png) 节点7加入,但节点7到节点7的距离为0,所以 不用更新minDist数组 @@ -262,7 +262,7 @@ minDist数组数值初始化为int最大值。 路径如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201111352.png) +![](https://file.kamacoder.com/pics/20240201111352.png) 在上面的讲解中,每一步 我都是按照 dijkstra 三部曲来讲解的,理解了这三部曲,代码也就好懂的。 @@ -431,7 +431,7 @@ select:4 看一下这个图: (有负权值) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227104334.png) +![](https://file.kamacoder.com/pics/20240227104334.png) 节点1 到 节点5 的最短路径 应该是 节点1 -> 节点2 -> 节点3 -> 节点4 -> 节点5 @@ -441,7 +441,7 @@ select:4 初始化: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227104801.png) +![](https://file.kamacoder.com/pics/20240227104801.png) --------------- @@ -455,7 +455,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110217.png) +![](https://file.kamacoder.com/pics/20240227110217.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -474,7 +474,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110330.png) +![](https://file.kamacoder.com/pics/20240227110330.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -492,7 +492,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110346.png) +![](https://file.kamacoder.com/pics/20240227110346.png) 由于节点4的加入,那么源点可以有新的路径链接到节点5 所以更新minDist数组: @@ -510,7 +510,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110405.png) +![](https://file.kamacoder.com/pics/20240227110405.png) 节点5的加入,而节点5 没有链接其他节点, 所以不用更新minDist数组,仅标记节点5被访问过了 @@ -526,7 +526,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110711.png) +![](https://file.kamacoder.com/pics/20240227110711.png) -------------- @@ -654,7 +654,7 @@ for (int v = 1; v <= n; v++) { 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240222110025.png) +![](https://file.kamacoder.com/pics/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间,有一条双向边,即:grid[2][5] = 6,grid[5][2] = 6 @@ -678,7 +678,7 @@ for (int v = 1; v <= n; v++) { 邻接表的构造如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 这里表达的图是: @@ -763,7 +763,7 @@ vector> grid(n + 1); 不少录友,不知道 如何定义的数据结构,怎么表示邻接表的,我来给大家画一个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 图中邻接表表示: @@ -784,7 +784,7 @@ vector>> grid(n + 1); 举例来给大家展示 该代码表达的数据 如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103904.png) +![](https://file.kamacoder.com/pics/20240223103904.png) * 节点1 指向 节点3 权值为 1 * 节点1 指向 节点5 权值为 2 @@ -907,7 +907,7 @@ for (int v = 1; v <= n; v++) { 再回顾一下邻接表的构造(数组 + 链表): -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 假如 加入的cur 是节点 2, 那么 grid[2] 表示的就是图中第二行链表。 (grid数组的构造我们在 上面 「图的存储」中讲过) diff --git "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" index 9145c7ed1d..147c7bfba7 100644 --- "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" @@ -52,7 +52,7 @@ 请你计算并返回达到楼梯顶部的最低花费。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221031170131.png) +![](https://file.kamacoder.com/pics/20221031170131.png) ## 思路 @@ -112,7 +112,7 @@ dp[i - 2] 跳到 dp[i] 需要花费 dp[i - 2] + cost[i - 2]。 拿示例2:cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1] ,来模拟一下dp数组的状态变化,如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221026175104.png) +![](https://file.kamacoder.com/pics/20221026175104.png) 如果大家代码写出来有问题,就把dp数组打印出来,看看和如上推导的是不是一样的。 diff --git "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" index 70ebfe4ff7..daf52bea55 100644 --- "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" +++ "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" @@ -44,7 +44,7 @@ 如图: -![763.划分字母区间](https://code-thinking-1253855093.file.myqcloud.com/pics/20201222191924417.png) +![763.划分字母区间](https://file.kamacoder.com/pics/20201222191924417.png) 明白原理之后,代码并不复杂,如下: diff --git "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" index 68d8421502..6133ac7733 100644 --- "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" +++ "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" @@ -9,11 +9,11 @@ 现在给定所有的城市和航班,以及出发城市 src 和目的地 dst,你的任务是找到出一条最多经过 k 站中转的路线,使得从 src 到 dst 的 价格最便宜 ,并返回该价格。 如果不存在这样的路线,则输出 -1。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240319103900.png) +![](https://file.kamacoder.com/pics/20240319103900.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240319103919.png) +![](https://file.kamacoder.com/pics/20240319103919.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240319104026.png) +![](https://file.kamacoder.com/pics/20240319104026.png) ## 思路 diff --git "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" index a37e5c3f8c..639b6b2b3b 100644 --- "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" +++ "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" @@ -11,7 +11,7 @@ graph[i] 是一个从节点 i 可以访问的所有节点的列表(即从节点 i 到节点 graph[i][j]存在一条有向边)。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221203135439.png) +![](https://file.kamacoder.com/pics/20221203135439.png) 提示: @@ -96,7 +96,7 @@ path.push_back(graph[x][i]); // 遍历到的节点加入到路径中来 一些录友可以疑惑这里如果找到x 链接的节点的,例如如果x目前是节点0,那么目前的过程就是这样的: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20221204111937.png) +![](https://file.kamacoder.com/pics/20221204111937.png) 二维数组中,graph[x][i] 都是x链接的节点,当前遍历的节点就是 `graph[x][i]` 。 diff --git "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" index 0ebda2524a..e6aa4601dd 100644 --- "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" +++ "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" @@ -51,11 +51,11 @@ 拿如下地图的岛屿情况来举例: (1为陆地) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829104834.png) +![](https://file.kamacoder.com/pics/20220829104834.png) 第一步,则遍历题目,并将岛屿到编号和面积上的统计,过程如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829105644.png) +![](https://file.kamacoder.com/pics/20220829105644.png) 本过程代码如下: @@ -102,7 +102,7 @@ int largestIsland(vector>& grid) { 第二步过程如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829105249.png) +![](https://file.kamacoder.com/pics/20220829105249.png) 也就是遍历每一个0的方格,并统计其相邻岛屿面积,最后取一个最大值。 diff --git "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" index 4076fce513..60180d2736 100644 --- "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" +++ "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" @@ -35,7 +35,7 @@ 图中给我的两个示例: `[[1],[2],[3],[]]` `[[1,3],[3,0,1],[2],[0]]`,画成对应的图如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220714101414.png) +![](https://file.kamacoder.com/pics/20220714101414.png) 我们可以看出图1的所有节点都是链接的,而图二中,节点2 是孤立的。 @@ -48,7 +48,7 @@ 图3:[[5], [], [1, 3], [5]] ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220714102201.png) +![](https://file.kamacoder.com/pics/20220714102201.png) 在图3中,大家可以发现,节点0只能到节点5,然后就哪也去不了了。 diff --git "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" index 383f6aa5b1..d4165f3672 100644 --- "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" +++ "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" @@ -16,7 +16,7 @@ * arr[0] < arr[1] < ... arr[i-1] < arr[i] * arr[i] > arr[i+1] > ... > arr[arr.length - 1] -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210729103604.png) +![](https://file.kamacoder.com/pics/20210729103604.png) 示例 1: * 输入:arr = [2,1] diff --git "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" index 0df2cc5b60..d8c31ca998 100644 --- "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" @@ -17,7 +17,7 @@ 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229175736596.png) +![](https://file.kamacoder.com/pics/20201229175736596.png) * 输入:[0,0,null,0,0] * 输出:1 @@ -25,7 +25,7 @@ 示例 2: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/2020122917584449.png) +![](https://file.kamacoder.com/pics/2020122917584449.png) * 输入:[0,0,null,0,null,0,null,null,0] * 输出:2 @@ -143,7 +143,7 @@ if (cur == NULL) return 2; 如图: -![968.监控二叉树2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229203710729.png) +![968.监控二叉树2](https://file.kamacoder.com/pics/20201229203710729.png) 代码如下: @@ -191,7 +191,7 @@ if (left == 1 || right == 1) return 2; **从这个代码中,可以看出,如果left == 1, right == 0 怎么办?其实这种条件在情况2中已经判断过了**,如图: -![968.监控二叉树1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020122920362355.png) +![968.监控二叉树1](https://file.kamacoder.com/pics/2020122920362355.png) 这种情况也是大多数同学容易迷惑的情况。 @@ -199,7 +199,7 @@ if (left == 1 || right == 1) return 2; 以上都处理完了,递归结束之后,可能头结点 还有一个无覆盖的情况,如图: -![968.监控二叉树3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229203742446.png) +![968.监控二叉树3](https://file.kamacoder.com/pics/20201229203742446.png) 所以递归结束之后,还要判断根节点,如果没有覆盖,result++,代码如下: diff --git "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" index 030d56a024..ae6b3895fa 100644 --- "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" +++ "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" @@ -12,13 +12,13 @@ 返回网格中 无法 在任意次数的移动中离开网格边界的陆地单元格的数量。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830100710.png) +![](https://file.kamacoder.com/pics/20220830100710.png) * 输入:grid = [[0,0,0,0],[1,0,1,0],[0,1,1,0],[0,0,0,0]] * 输出:3 * 解释:有三个 1 被 0 包围。一个 1 没有被包围,因为它在边界上。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830100742.png) +![](https://file.kamacoder.com/pics/20220830100742.png) * 输入:grid = [[0,1,1,0],[0,0,1,0],[0,0,1,0],[0,0,0,0]] * 输出:0 @@ -32,11 +32,11 @@ 如图,在遍历地图周围四个边,靠地图四边的陆地,都为绿色, -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830104632.png) +![](https://file.kamacoder.com/pics/20220830104632.png) 在遇到地图周边陆地的时候,将1都变为0,此时地图为这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830104651.png) +![](https://file.kamacoder.com/pics/20220830104651.png) 然后我们再去遍历这个地图,遇到有陆地的地方,去采用深搜或者广搜,边统计所有陆地。 diff --git "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" index 53e0f370e7..0119df82ea 100644 --- "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" +++ "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" @@ -18,7 +18,7 @@ 以这种方法绘制线条,并返回可以绘制的最大连线数。 -![1035.不相交的线](https://code-thinking-1253855093.file.myqcloud.com/pics/2021032116363533.png) +![1035.不相交的线](https://file.kamacoder.com/pics/2021032116363533.png) ## 算法公开课 @@ -36,7 +36,7 @@ 拿示例一nums1 = [1,4,2], nums2 = [1,2,4]为例,相交情况如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914145158.png) +![](https://file.kamacoder.com/pics/20210914145158.png) 其实也就是说nums1和nums2的最长公共子序列是[1,4],长度为2。 这个公共子序列指的是相对顺序不变(即数字4在字符串nums1中数字1的后面,那么数字4也应该在字符串nums2数字1的后面) diff --git "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" index 62e7d9c590..6dfba4ed44 100644 --- "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" +++ "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" @@ -114,7 +114,7 @@ for (int i = 0; i < stones.size(); i++) { // 遍历物品 举例,输入:[2,4,1,1],此时target = (2 + 4 + 1 + 1)/2 = 4 ,dp数组状态图如下: -![1049.最后一块石头的重量II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210121115805904.jpg) +![1049.最后一块石头的重量II](https://file.kamacoder.com/pics/20210121115805904.jpg) 最后dp[target]里是容量为target的背包所能背的最大重量。 diff --git "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" index 821f3c42a1..91c29b8313 100644 --- "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" @@ -94,7 +94,7 @@ vector> dp(text1.size() + 1, vector(text2.size() + 1, 0)); 从递推公式,可以看出,有三个方向可以推出dp[i][j],如图: -![1143.最长公共子序列](https://code-thinking-1253855093.file.myqcloud.com/pics/20210204115139616.jpg) +![1143.最长公共子序列](https://file.kamacoder.com/pics/20210204115139616.jpg) 那么为了在递推的过程中,这三个方向都是经过计算的数值,所以要从前向后,从上到下来遍历这个矩阵。 @@ -103,7 +103,7 @@ vector> dp(text1.size() + 1, vector(text2.size() + 1, 0)); 以输入:text1 = "abcde", text2 = "ace" 为例,dp状态如图: -![1143.最长公共子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210210150215918.jpg) +![1143.最长公共子序列1](https://file.kamacoder.com/pics/20210210150215918.jpg) 最后红框dp[text1.size()][text2.size()]为最终结果 diff --git "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" index 5d99670950..ebea30e34f 100644 --- "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" +++ "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" @@ -10,13 +10,13 @@ 请返回 封闭岛屿 的数目。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830111533.png) +![](https://file.kamacoder.com/pics/20220830111533.png) * 输入:grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]] * 输出:2 * 解释:灰色区域的岛屿是封闭岛屿,因为这座岛屿完全被水域包围(即被 1 区域包围)。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830111601.png) +![](https://file.kamacoder.com/pics/20220830111601.png) * 输入:grid = [[0,0,1,0,0],[0,1,0,1,0],[0,1,1,1,0]] * 输出:1 diff --git "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" index 7a1a7f3cb9..7b0d32048a 100644 --- "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" +++ "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" @@ -15,7 +15,7 @@ 示例: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210726154512.png) +![](https://file.kamacoder.com/pics/20210726154512.png) * 输入:root = [1,null,2,null,3,null,4,null,null] * 输出:[2,1,3,null,null,null,4] diff --git "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" index e9ea5f4463..5dd56c65d9 100644 --- "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" +++ "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" @@ -10,7 +10,7 @@ 什么是度,可以理解为,链接节点的边的数量。 题目中度如图所示: -![1791.找出星型图的中心节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20220704113207.png) +![1791.找出星型图的中心节点](https://file.kamacoder.com/pics/20220704113207.png) 至于出度和入度,那就是在有向图里的概念了,本题是无向图。 diff --git "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" index acb544155a..33b48698b5 100644 --- "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" +++ "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" @@ -12,7 +12,7 @@ 给你数组 edges 和整数 n、start 和 end,如果从 start 到 end 存在 有效路径 ,则返回 true,否则返回 false 。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220705101442.png) +![](https://file.kamacoder.com/pics/20220705101442.png) diff --git "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" index 7276af53b3..830bba7e2a 100644 --- "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" +++ "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" @@ -13,7 +13,7 @@ ## 超时是怎么回事 -![程序超时](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729112716117.png) +![程序超时](https://file.kamacoder.com/pics/20200729112716117.png) 大家在leetcode上练习算法的时候应该都遇到过一种错误是“超时”。 @@ -129,11 +129,11 @@ int main() { 来看一下运行的效果,如下图: -![程序超时2](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729200018460.png) +![程序超时2](https://file.kamacoder.com/pics/20200729200018460.png) O(n)的算法,1s内大概计算机可以运行 5 * (10^8)次计算,可以推测一下O(n^2) 的算法应该1s可以处理的数量级的规模是 5 * (10^8)开根号,实验数据如下。 -![程序超时3](https://code-thinking-1253855093.file.myqcloud.com/pics/2020072919590970.png) +![程序超时3](https://file.kamacoder.com/pics/2020072919590970.png) O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚刚的推测。 @@ -141,7 +141,7 @@ O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚 理论上应该是比 O(n)少一个数量级,因为logn的复杂度 其实是很快,看一下实验数据。 -![程序超时4](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729195729407.png) +![程序超时4](https://file.kamacoder.com/pics/20200729195729407.png) O(nlogn)的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符合预期。 @@ -149,7 +149,7 @@ O(nlogn)的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符 **整体测试数据整理如下:** -![程序超时1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201208231559175.png) +![程序超时1](https://file.kamacoder.com/pics/20201208231559175.png) 至于O(log n)和O(n^3) 等等这些时间复杂度在1s内可以处理的多大的数据规模,大家可以自己写一写代码去测一下了。 diff --git "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" index 75c12f8a96..e361e8e0d9 100644 --- "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" +++ "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" @@ -46,13 +46,13 @@ 如下图所示,起始车站为 1 号车站,终点车站为 7 号车站,绿色路线为最短的路线,路线总长度为 12,则输出 12。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227101345.png) +![](https://file.kamacoder.com/pics/20240227101345.png) 不能到达的情况: 如下图所示,当从起始车站不能到达终点车站时,则输出 -1。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227101401.png) +![](https://file.kamacoder.com/pics/20240227101401.png) 数据范围: @@ -101,7 +101,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240222110025.png) +![](https://file.kamacoder.com/pics/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间,有一条双向边,即:grid[2][5] = 6,grid[5][2] = 6 @@ -125,7 +125,7 @@ 邻接表的构造如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 这里表达的图是: @@ -210,7 +210,7 @@ vector> grid(n + 1); 不少录友,不知道 如何定义的数据结构,怎么表示邻接表的,我来给大家画一个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 图中邻接表表示: @@ -231,7 +231,7 @@ vector>> grid(n + 1); 举例来给大家展示 该代码表达的数据 如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103904.png) +![](https://file.kamacoder.com/pics/20240223103904.png) * 节点1 指向 节点3 权值为 1 * 节点1 指向 节点5 权值为 2 @@ -354,7 +354,7 @@ for (int v = 1; v <= n; v++) { 再回顾一下邻接表的构造(数组 + 链表): -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 假如 加入的cur 是节点 2, 那么 grid[2] 表示的就是图中第二行链表。 (grid数组的构造我们在 上面 「图的存储」中讲过) diff --git "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" index e71e9d5374..1ff9f1a874 100644 --- "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" +++ "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" @@ -46,13 +46,13 @@ 如下图所示,起始车站为 1 号车站,终点车站为 7 号车站,绿色路线为最短的路线,路线总长度为 12,则输出 12。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227101345.png) +![](https://file.kamacoder.com/pics/20240227101345.png) 不能到达的情况: 如下图所示,当从起始车站不能到达终点车站时,则输出 -1。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227101401.png) +![](https://file.kamacoder.com/pics/20240227101401.png) 数据范围: @@ -76,7 +76,7 @@ dijkstra算法:在有权图(权值非负数)中求从起点到其他节点 如本题示例中的图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240125162647.png) +![](https://file.kamacoder.com/pics/20240125162647.png) 起点(节点1)到终点(节点7) 的最短路径是 图中 标记绿线的部分。 @@ -122,7 +122,7 @@ minDist数组数值初始化为int最大值。 这里在强点一下 **minDist数组的含义:记录所有节点到源点的最短路径**,那么初始化的时候就应该初始为最大值,这样才能在后续出现最短路径的时候及时更新。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115306.png) +![](https://file.kamacoder.com/pics/20240130115306.png) (图中,max 表示默认值,节点0 不做处理,统一从下标1 开始计算,这样下标和节点数值统一, 方便大家理解,避免搞混) @@ -144,7 +144,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115421.png) +![](https://file.kamacoder.com/pics/20240130115421.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -170,7 +170,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130121240.png) +![](https://file.kamacoder.com/pics/20240130121240.png) 更新 minDist数组,即:源点(节点1) 到 节点6 、 节点3 和 节点4的距离。 @@ -204,7 +204,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130120434.png) +![](https://file.kamacoder.com/pics/20240130120434.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -224,7 +224,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201105335.png) +![](https://file.kamacoder.com/pics/20240201105335.png) 由于节点4的加入,那么源点可以链接到节点5 所以更新minDist数组: @@ -244,7 +244,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110250.png) +![](https://file.kamacoder.com/pics/20240201110250.png) 由于节点6的加入,那么源点可以链接到节点7 所以 更新minDist数组: @@ -264,7 +264,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110651.png) +![](https://file.kamacoder.com/pics/20240201110651.png) 由于节点5的加入,那么源点有新的路径可以链接到节点7 所以 更新minDist数组: @@ -282,7 +282,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201110920.png) +![](https://file.kamacoder.com/pics/20240201110920.png) 节点7加入,但节点7到节点7的距离为0,所以 不用更新minDist数组 @@ -296,7 +296,7 @@ minDist数组数值初始化为int最大值。 路径如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201111352.png) +![](https://file.kamacoder.com/pics/20240201111352.png) 在上面的讲解中,每一步 我都是按照 dijkstra 三部曲来讲解的,理解了这三部曲,代码也就好懂的。 @@ -541,7 +541,7 @@ int main() { 对应如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201111352.png) +![](https://file.kamacoder.com/pics/20240201111352.png) ### 出现负数 @@ -549,7 +549,7 @@ int main() { 看一下这个图: (有负权值) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227104334.png) +![](https://file.kamacoder.com/pics/20240227104334.png) 节点1 到 节点5 的最短路径 应该是 节点1 -> 节点2 -> 节点3 -> 节点4 -> 节点5 @@ -559,7 +559,7 @@ int main() { 初始化: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227104801.png) +![](https://file.kamacoder.com/pics/20240227104801.png) --------------- @@ -573,7 +573,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110217.png) +![](https://file.kamacoder.com/pics/20240227110217.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -592,7 +592,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110330.png) +![](https://file.kamacoder.com/pics/20240227110330.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -610,7 +610,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110346.png) +![](https://file.kamacoder.com/pics/20240227110346.png) 由于节点4的加入,那么源点可以有新的路径链接到节点5 所以更新minDist数组: @@ -628,7 +628,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110405.png) +![](https://file.kamacoder.com/pics/20240227110405.png) 节点5的加入,而节点5 没有链接其他节点, 所以不用更新minDist数组,仅标记节点5被访问过了 @@ -644,7 +644,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240227110711.png) +![](https://file.kamacoder.com/pics/20240227110711.png) -------------- diff --git "a/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" "b/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" index 861efe6806..585fa4767e 100644 --- "a/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" +++ "b/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" @@ -63,7 +63,7 @@ kruscal的思路: 依然以示例中,如下这个图来举例。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240111113514.png) +![](https://file.kamacoder.com/pics/20240111113514.png) 将图中的边按照权值有小到大排序,这样从贪心的角度来说,优先选 权值小的边加入到 最小生成树中。 @@ -77,13 +77,13 @@ kruscal的思路: 选边(1,2),节点1 和 节点2 不在同一个集合,所以生成树可以添加边(1,2),并将 节点1,节点2 放在同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240111114204.png) +![](https://file.kamacoder.com/pics/20240111114204.png) -------- 选边(4,5),节点4 和 节点 5 不在同一个集合,生成树可以添加边(4,5) ,并将节点4,节点5 放到同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240111120458.png) +![](https://file.kamacoder.com/pics/20240111120458.png) **大家判断两个节点是否在同一个集合,就看图中两个节点是否有绿色的粗线连着就行** @@ -93,25 +93,25 @@ kruscal的思路: 选边(1,3),节点1 和 节点3 不在同一个集合,生成树添加边(1,3),并将节点1,节点3 放到同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240112105834.png) +![](https://file.kamacoder.com/pics/20240112105834.png) --------- 选边(2,6),节点2 和 节点6 不在同一个集合,生成树添加边(2,6),并将节点2,节点6 放到同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240112110214.png) +![](https://file.kamacoder.com/pics/20240112110214.png) -------- 选边(3,4),节点3 和 节点4 不在同一个集合,生成树添加边(3,4),并将节点3,节点4 放到同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240112110450.png) +![](https://file.kamacoder.com/pics/20240112110450.png) ---------- 选边(6,7),节点6 和 节点7 不在同一个集合,生成树添加边(6,7),并将 节点6,节点7 放到同一个集合。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240112110637.png) +![](https://file.kamacoder.com/pics/20240112110637.png) ----------- @@ -126,7 +126,7 @@ kruscal的思路: 此时 我们就已经生成了一个最小生成树,即: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240112110637.png) +![](https://file.kamacoder.com/pics/20240112110637.png) 在上面的讲解中,看图的话 大家知道如何判断 两个节点 是否在同一个集合(是否有绿色的线连在一起),以及如何把两个节点加入集合(就在图中把两个节点连上) @@ -346,7 +346,7 @@ int main() { 大家可能发现 怎么和我们 模拟画的图不一样,差别在于 代码生成的最小生成树中 节点5 和 节点7相连的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240116163014.png) +![](https://file.kamacoder.com/pics/20240116163014.png) 其实造成这个差别 是对边排序的时候 权值相同的边先后顺序的问题导致的,无论相同权值边的顺序是什么样的,最后都能得出最小生成树。 @@ -366,7 +366,7 @@ Kruskal 与 prim 的关键区别在于,prim维护的是节点的集合,而 K 节点未必一定要连着边那, 例如 这个图,大家能明显感受到边没有那么多对吧,但节点数量 和 上述我们讲的例子是一样的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240116152211.png) +![](https://file.kamacoder.com/pics/20240116152211.png) 为什么边少的话,使用 Kruskal 更优呢? diff --git "a/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" "b/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" index 8e26bea4bd..a7d3584178 100644 --- "a/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" +++ "b/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" @@ -61,7 +61,7 @@ 例如本题示例中的无向有权图为: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231206164306.png) +![](https://file.kamacoder.com/pics/20231206164306.png) 那么在这个图中,如何选取n-1条边使得图中所有节点连接到一起,并且边的权值和最小呢? @@ -100,7 +100,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231215105603.png) +![](https://file.kamacoder.com/pics/20231215105603.png) 开始构造最小生成树 @@ -118,7 +118,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来,我们要更新所有节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102048.png) +![](https://file.kamacoder.com/pics/20231222102048.png) 注意下标0,我们就不管它了,下标1与节点1对应,这样可以避免大家把节点搞混。 @@ -148,7 +148,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来,我们要更新节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102431.png) +![](https://file.kamacoder.com/pics/20231222102431.png) 此时所有非生成树的节点距离最小生成树(节点1、节点2)的距离都已经跟新了。 @@ -172,7 +172,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来更新节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102457.png) +![](https://file.kamacoder.com/pics/20231222102457.png) 所有非生成树的节点距离最小生成树(节点1、节点2、节点3)的距离都已经跟新了。 @@ -188,7 +188,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 继续选择一个距离最小生成树(节点1、节点2、节点3)最近的非生成树里的节点,为了巩固大家对minDist数组的理解,这里我再啰嗦一遍: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231217213516.png) +![](https://file.kamacoder.com/pics/20231217213516.png) **minDist数组是记录了所有非生成树节点距离生成树的最小距离**,所以从数组里我们能看出来,非生成树节点4和节点6距离生成树最近。 @@ -209,7 +209,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来更新节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102618.png) +![](https://file.kamacoder.com/pics/20231222102618.png) minDist数组已经更新了所有非生成树的节点距离最小生成树(节点1、节点2、节点3、节点4)的距离。 @@ -232,7 +232,7 @@ minDist数组已经更新了所有非生成树的节点距离最小生成树( 接下来更新节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102646.png) +![](https://file.kamacoder.com/pics/20231222102646.png) minDist数组已经更新了所有非生成树的节点距离最小生成树(节点1、节点2、节点3、节点4、节点5)的距离。 @@ -253,11 +253,11 @@ minDist数组已经更新了所有非生成树的节点距离最小生成树( 节点1、节点2、节点3、节点4、节点5、节点6算是最小生成树的节点,接下来更新节点距离最小生成树的距离,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102732.png) +![](https://file.kamacoder.com/pics/20231222102732.png) 这里就不在重复描述了,大家类推,最后,节点7加入生成树,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231222102820.png) +![](https://file.kamacoder.com/pics/20231222102820.png) ### 最后 @@ -478,7 +478,7 @@ int main() { 大家可以和我们本题最后生成的最小生成树的图去对比一下边的链接情况: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231229115714.png) +![](https://file.kamacoder.com/pics/20231229115714.png) 绿色的边是最小生成树,和我们的输出完全一致。 diff --git "a/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" "b/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" index f788d65ba7..665e8ecbae 100644 --- "a/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" +++ "b/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" @@ -29,11 +29,11 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231030165201.png) +![](https://file.kamacoder.com/pics/20231030165201.png) 然后从后向前替换数字字符,也就是双指针法,过程如下:i指向新长度的末尾,j指向旧长度的末尾。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231030173058.png) +![](https://file.kamacoder.com/pics/20231030173058.png) 有同学问了,为什么要从后向前填充,从前向后填充不行么? diff --git "a/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" "b/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" index 2b32cb44d2..48150222a7 100644 --- "a/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" @@ -40,16 +40,16 @@ fgabcde 本题中,我们需要将字符串右移n位,字符串相当于分成了两个部分,如果n为2,符串相当于分成了两个部分,如图: (length为字符串长度) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106170143.png) +![](https://file.kamacoder.com/pics/20231106170143.png) 右移n位, 就是将第二段放在前面,第一段放在后面,先不考虑里面字符的顺序,是不是整体倒叙不就行了。如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106171557.png) +![](https://file.kamacoder.com/pics/20231106171557.png) 此时第一段和第二段的顺序是我们想要的,但里面的字符位置被我们倒叙,那么此时我们在把 第一段和第二段里面的字符再倒叙一把,这样字符顺序不就正确了。 如果: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106172058.png) +![](https://file.kamacoder.com/pics/20231106172058.png) 其实,思路就是 通过 整体倒叙,把两段子串顺序颠倒,两个段子串里的的字符在倒叙一把,**负负得正**,这样就不影响子串里面字符的顺序了。 @@ -80,7 +80,7 @@ int main() { 可以的,不过,要记得 控制好 局部反转的长度,如果先局部反转,那么先反转的子串长度就是 len - n,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106172534.png) +![](https://file.kamacoder.com/pics/20231106172534.png) 代码如下: diff --git "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" index 23e7189a15..a6342ef8c0 100644 --- "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" +++ "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" @@ -93,7 +93,7 @@ int main() { 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240627110604.png) +![](https://file.kamacoder.com/pics/20240627110604.png) 如果,我们想统计,在vec数组上 下标 2 到下标 5 之间的累加和,那是不是就用 p[5] - p[1] 就可以了。 @@ -109,7 +109,7 @@ int main() { 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240627111319.png) +![](https://file.kamacoder.com/pics/20240627111319.png) `p[5] - p[1]` 就是 红色部分的区间和。 diff --git "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" index 99986aaa2d..b592029276 100644 --- "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" +++ "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" @@ -62,7 +62,7 @@ 给大家举一个例子: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240328104119.png) +![](https://file.kamacoder.com/pics/20240328104119.png) 本图中,对所有边进行松弛,真正有效的松弛,只有松弛 边(节点1->节点2) 和 边(节点1->节点3) 。 @@ -97,7 +97,7 @@ 初始化,起点为节点1, 起点到起点的最短距离为0,所以minDist[1] 为 0。 将节点1 加入队列 (下次松弛从节点1开始) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240411115555.png) +![](https://file.kamacoder.com/pics/20240411115555.png) ------------ @@ -109,7 +109,7 @@ 将节点2、节点3 加入队列,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240411115544.png) +![](https://file.kamacoder.com/pics/20240411115544.png) ----------------- @@ -124,7 +124,7 @@ 将节点4,节点5 加入队列,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240412110348.png) +![](https://file.kamacoder.com/pics/20240412110348.png) -------------------- @@ -134,7 +134,7 @@ 因为没有从节点3作为出发点的边,所以这里就从队列里取出节点3就好,不用做其他操作,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240412110420.png) +![](https://file.kamacoder.com/pics/20240412110420.png) ------------ @@ -147,7 +147,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240412110445.png) +![](https://file.kamacoder.com/pics/20240412110445.png) --------------- @@ -160,7 +160,7 @@ 如图,将节点3加入队列,因为节点6已经在队列里,所以不用重复添加 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240729161116.png) +![](https://file.kamacoder.com/pics/20240729161116.png) 所以我们在加入队列的过程可以有一个优化,**用visited数组记录已经在队列里的元素,已经在队列的元素不用重复加入** @@ -174,7 +174,7 @@ 所以直接从队列中取出,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240411115424.png) +![](https://file.kamacoder.com/pics/20240411115424.png) ---------- @@ -264,7 +264,7 @@ int main() { 至于为什么 双向图且每一个节点和所有其他节点都相连的话,每个节点 都有 n-1 条指向该节点的边, 我再来举个例子,如图: -[](https://code-thinking-1253855093.file.myqcloud.com/pics/20240416104138.png) +[](https://file.kamacoder.com/pics/20240416104138.png) 图中 每个节点都与其他所有节点相连,节点数n 为 4,每个节点都有3条指向该节点的边,即入度为3。 @@ -329,7 +329,7 @@ SPFA(队列优化版Bellman_ford) 在理论上 时间复杂度更胜一筹 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240412111849.png) +![](https://file.kamacoder.com/pics/20240412111849.png) 正权回路 就是有环,但环的总权值为正数。 diff --git "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" index 2afc014b7e..9edde8ace3 100644 --- "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" +++ "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" @@ -46,7 +46,7 @@ 1 3 5 ``` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240509200224.png) +![](https://file.kamacoder.com/pics/20240509200224.png) ## 思路 @@ -78,7 +78,7 @@ 这里我给大家举一个例子,每条边有起点、终点和边的权值。例如一条边,节点A 到 节点B 权值为value,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240327102620.png) +![](https://file.kamacoder.com/pics/20240327102620.png) minDist[B] 表示 到达B节点 最小权值,minDist[B] 有哪些状态可以推出来? @@ -127,7 +127,7 @@ if (minDist[B] > minDist[A] + value) minDist[B] = minDist[A] + value 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240328104119.png) +![](https://file.kamacoder.com/pics/20240328104119.png) 其他节点对应的minDist初始化为max,因为我们要求最小距离,那么还没有计算过的节点 默认是一个最大数,这样才能更新最小距离。 @@ -150,36 +150,36 @@ if (minDist[B] > minDist[A] + value) minDist[B] = minDist[A] + value 边:节点5 -> 节点6,权值为-2 ,minDist[5] 还是默认数值max,所以不能基于 节点5 去更新节点6,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329113537.png) +![](https://file.kamacoder.com/pics/20240329113537.png) (在复习一下,minDist[5] 表示起点到节点5的最短距离) 边:节点1 -> 节点2,权值为1 ,minDist[2] > minDist[1] + 1 ,更新 minDist[2] = minDist[1] + 1 = 0 + 1 = 1 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329113703.png) +![](https://file.kamacoder.com/pics/20240329113703.png) 边:节点5 -> 节点3,权值为1 ,minDist[5] 还是默认数值max,所以不能基于节点5去更新节点3 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329113827.png) +![](https://file.kamacoder.com/pics/20240329113827.png) 边:节点2 -> 节点5,权值为2 ,minDist[5] > minDist[2] + 2 (经过上面的计算minDist[2]已经不是默认值,而是 1),更新 minDist[5] = minDist[2] + 2 = 1 + 2 = 3 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329113927.png) +![](https://file.kamacoder.com/pics/20240329113927.png) 边:节点2 -> 节点4,权值为-3 ,minDist[4] > minDist[2] + (-3),更新 minDist[4] = minDist[2] + (-3) = 1 + (-3) = -2 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329114036.png) +![](https://file.kamacoder.com/pics/20240329114036.png) 边:节点4 -> 节点6,权值为4 ,minDist[6] > minDist[4] + 4,更新 minDist[6] = minDist[4] + 4 = -2 + 4 = 2 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329114120.png) +![](https://file.kamacoder.com/pics/20240329114120.png) 边:节点1 -> 节点3,权值为5 ,minDist[3] > minDist[1] + 5,更新 minDist[3] = minDist[1] + 5 = 0 + 5 = 5 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240329114324.png) +![](https://file.kamacoder.com/pics/20240329114324.png) -------- diff --git "a/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" "b/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" index a3896b8896..5dddf45013 100644 --- "a/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" +++ "b/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" @@ -78,7 +78,7 @@ circle 我们拿题目中示例来画一个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240705161426.png) +![](https://file.kamacoder.com/pics/20240705161426.png) 图中 节点1 到 节点4 的最短路径是多少(题目中的最低运输成本) (注意边可以为负数的) @@ -86,7 +86,7 @@ circle 而图中有负权回路: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240402103712.png) +![](https://file.kamacoder.com/pics/20240402103712.png) 那么我们在负权回路中多绕一圈,我们的最短路径 是不是就更小了 (也就是更低的运输成本) diff --git "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" index eb80e048f6..37cfaee0e3 100644 --- "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" +++ "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" @@ -63,7 +63,7 @@ 本题是最多经过 k 个城市, 那么是 k + 1条边相连的节点。 这里可能有录友想不懂为什么是k + 1,来看这个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240402115614.png) +![](https://file.kamacoder.com/pics/20240402115614.png) 图中,节点1 最多已经经过2个节点 到达节点4,那么中间是有多少条边呢,是 3 条边对吧。 @@ -195,7 +195,7 @@ int main() { 起点为节点1, 起点到起点的距离为0,所以 minDist[1] 初始化为0 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240409111940.png) +![](https://file.kamacoder.com/pics/20240409111940.png) 其他节点对应的minDist初始化为max,因为我们要求最小距离,那么还没有计算过的节点 默认是一个最大数,这样才能更新最小距离。 @@ -203,21 +203,21 @@ int main() { 边:节点1 -> 节点2,权值为-1 ,minDist[2] > minDist[1] + (-1),更新 minDist[2] = minDist[1] + (-1) = 0 - 1 = -1 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240409111914.png) +![](https://file.kamacoder.com/pics/20240409111914.png) 边:节点2 -> 节点3,权值为1 ,minDist[3] > minDist[2] + 1 ,更新 minDist[3] = minDist[2] + 1 = -1 + 1 = 0 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240409111903.png) +![](https://file.kamacoder.com/pics/20240409111903.png) 边:节点3 -> 节点1,权值为-1 ,minDist[1] > minDist[3] + (-1),更新 minDist[1] = 0 + (-1) = -1 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240409111849.png) +![](https://file.kamacoder.com/pics/20240409111849.png) 边:节点3 -> 节点4,权值为1 ,minDist[4] > minDist[3] + 1,更新 minDist[4] = 0 + 1 = 1 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20241018192042.png) +![](https://file.kamacoder.com/pics/20241018192042.png) 以上是对所有边进行的第一次松弛,最后 minDist数组为 :-1 -1 0 1 ,(从下标1算起) @@ -244,7 +244,7 @@ int main() { 在上面画图距离中,对所有边进行第一次松弛,在计算 边(节点2 -> 节点3) 的时候,更新了 节点3。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240409111903.png) +![](https://file.kamacoder.com/pics/20240409111903.png) 理论上来说节点3 应该在对所有边第二次松弛的时候才更新。 这因为当时是基于已经计算好的 节点2(minDist[2])来做计算了。 @@ -331,11 +331,11 @@ int main() { 所构成是图是一样的,都是如下的这个图,但给出的边的顺序是不一样的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240410154340.png) +![](https://file.kamacoder.com/pics/20240410154340.png) 再用版本一的代码是运行一下,发现结果输出是 1, 是对的。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240410154940.png) +![](https://file.kamacoder.com/pics/20240410154940.png) 分明刚刚输出的结果是 -2,是错误的,怎么 一样的图,这次输出的结果就对了呢? @@ -345,7 +345,7 @@ int main() { 初始化: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240410155545.png) +![](https://file.kamacoder.com/pics/20240410155545.png) 边:节点3 -> 节点1,权值为-1 ,节点3还没有被计算过,节点1 不更新。 @@ -355,7 +355,7 @@ int main() { 边:节点1 -> 节点2,权值为 -1 ,minDist[2] > minDist[1] + (-1),更新 minDist[2] = 0 + (-1) = -1 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240410160046.png) +![](https://file.kamacoder.com/pics/20240410160046.png) 以上是对所有边 松弛一次的状态。 @@ -472,7 +472,7 @@ int main() { 但大家会发现,以上代码大家提交后,怎么耗时这么多? -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240418113308.png) +![](https://file.kamacoder.com/pics/20240418113308.png) 理论上,SPFA的时间复杂度不是要比 bellman_ford 更优吗? @@ -554,7 +554,7 @@ int main() { 以上代码提交后,耗时情况: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240418113952.png) +![](https://file.kamacoder.com/pics/20240418113952.png) 大家发现 依然远比 bellman_ford 的代码版本 耗时高。 @@ -579,11 +579,11 @@ dijkstra 是贪心的思路 每一次搜索都只会找距离源点最近的非 在以下这个图中,求节点1 到 节点7 最多经过2个节点 的最短路是多少呢? -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240508112249.png) +![](https://file.kamacoder.com/pics/20240508112249.png) 最短路显然是: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240508112416.png) +![](https://file.kamacoder.com/pics/20240508112416.png) 最多经过2个节点,也就是3条边相连的路线:节点1 -> 节点2 -> 节点6-> 节点7 @@ -591,24 +591,24 @@ dijkstra 是贪心的思路 每一次搜索都只会找距离源点最近的非 初始化如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115306.png) +![](https://file.kamacoder.com/pics/20240130115306.png) 找距离源点最近且没有被访问过的节点,先找节点1 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130115421.png) +![](https://file.kamacoder.com/pics/20240130115421.png) 距离源点最近且没有被访问过的节点,找节点2: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130121240.png) +![](https://file.kamacoder.com/pics/20240130121240.png) 距离源点最近且没有被访问过的节点,找到节点3: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240130120434.png) +![](https://file.kamacoder.com/pics/20240130120434.png) 距离源点最近且没有被访问过的节点,找到节点4: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240201105335.png) +![](https://file.kamacoder.com/pics/20240201105335.png) 此时最多经过2个节点的搜索就完毕了,但结果中minDist[7] (即节点7的结果)并没有被更。 diff --git "a/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" "b/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" index dfbd6aa9a8..97765ebc7b 100644 --- "a/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" +++ "b/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" @@ -155,7 +155,7 @@ grid[i][j][k] = m,表示 节点i 到 节点j 以[1...k] 集合为中间节点 grid数组是一个三维数组,那么我们初始化的数据在 i 与 j 构成的平层,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240425104247.png) +![](https://file.kamacoder.com/pics/20240425104247.png) 红色的 底部一层是我们初始化好的数据,注意:从三维角度去看初始化的数据很重要,下面我们在聊遍历顺序的时候还会再讲。 @@ -202,7 +202,7 @@ vector>> grid(n + 1, vector>(n + 1, vector(n 所以遍历k 的for循环一定是在最外面,这样才能一层一层去遍历。如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240424120109.png) +![](https://file.kamacoder.com/pics/20240424120109.png) 至于遍历 i 和 j 的话,for 循环的先后顺序无所谓。 @@ -234,7 +234,7 @@ for (int i = 1; i <= n; i++) { 此时就遍历了 j 与 k 形成一个平面,i 则是纵面,那遍历 就是这样的: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240424115827.png) +![](https://file.kamacoder.com/pics/20240424115827.png) 而我们初始化的数据 是 k 为0, i 和 j 形成的平面做初始化,如果以 k 和 j 形成的平面去一层一层遍历,就造成了 递推公式 用不上上一轮计算的结果,从而导致结果不对(初始化的部分是 i 与j 形成的平面,在初始部分有讲过)。 @@ -253,7 +253,7 @@ for (int i = 1; i <= n; i++) { 就是图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240424120942.png) +![](https://file.kamacoder.com/pics/20240424120942.png) 求节点1 到 节点 2 的最短距离,运行结果是 10 ,但正确的结果很明显是3。 @@ -267,7 +267,7 @@ for (int i = 1; i <= n; i++) { 而遍历k 的for循环如果放在中间呢,同样是 j 与k 行程一个平面,i 是纵面,遍历的也是这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240424115827.png) +![](https://file.kamacoder.com/pics/20240424115827.png) 同样不能完全用上初始化 和 上一层计算的结果。 @@ -283,7 +283,7 @@ for (int i = 1; i <= n; i++) { 图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240425112636.png) +![](https://file.kamacoder.com/pics/20240425112636.png) 求 节点1 到节点3 的最短距离,如果k循环放中间,程序的运行结果是 -1,也就是不能到达节点3。 diff --git "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" index 4df53b448f..2f0dcdcc87 100644 --- "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" @@ -43,7 +43,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240514103953.png) +![](https://file.kamacoder.com/pics/20240514103953.png) 用例解释: @@ -141,7 +141,7 @@ while (m--) { 我在 [图论理论基础篇](./图论理论基础.md) 举了一个例子: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 这里表达的图是: diff --git "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" index f8c36a00a8..0da2f315a1 100644 --- "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" +++ "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" @@ -35,7 +35,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240516111613.png) +![](https://file.kamacoder.com/pics/20240516111613.png) 根据测试案例中所展示,岛屿数量共有 3 个,所以输出 3。 @@ -50,7 +50,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 @@ -72,7 +72,7 @@ 如果从队列拿出节点,再去标记这个节点走过,就会发生下图所示的结果,会导致很多节点重复加入队列。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250124094043.png) +![](https://file.kamacoder.com/pics/20250124094043.png) 超时写法 (从队列中取出节点再标记,注意代码注释的地方) diff --git "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" index 5a21f387fc..06be926874 100644 --- "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" +++ "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" @@ -36,7 +36,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240516111613.png) +![](https://file.kamacoder.com/pics/20240516111613.png) 根据测试案例中所展示,岛屿数量共有 3 个,所以输出 3。 @@ -50,7 +50,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 diff --git "a/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" "b/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" index 170c0917aa..f2b9b901d1 100644 --- "a/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" +++ "b/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" @@ -33,7 +33,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517103410.png) +![](https://file.kamacoder.com/pics/20240517103410.png) 样例输入中,岛屿的最大面积为 4。 @@ -48,7 +48,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220726094200.png) +![图一](https://file.kamacoder.com/pics/20220726094200.png) 这道题目也是 dfs bfs基础类题目,就是搜索每个岛屿上“1”的数量,然后取一个最大的。 diff --git "a/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" "b/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" index 43ac8ec96d..c8fe372cd9 100644 --- "a/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" +++ "b/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" @@ -37,7 +37,7 @@ 提示信息: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517105557.png) +![](https://file.kamacoder.com/pics/20240517105557.png) 在矩阵中心部分的岛屿,因为没有任何一个单元格接触到矩阵边缘,所以该岛屿属于孤岛,总面积为 1。 @@ -54,11 +54,11 @@ 如图,在遍历地图周围四个边,靠地图四边的陆地,都为绿色, -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830104632.png) +![](https://file.kamacoder.com/pics/20220830104632.png) 在遇到地图周边陆地的时候,将1都变为0,此时地图为这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220830104651.png) +![](https://file.kamacoder.com/pics/20220830104651.png) 然后我们再去遍历这个地图,遇到有陆地的地方,去采用深搜或者广搜,边统计所有陆地。 diff --git "a/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" "b/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" index 5e211cd09c..265ec31f73 100644 --- "a/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" +++ "b/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" @@ -43,11 +43,11 @@ 提示信息: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517110932.png) +![](https://file.kamacoder.com/pics/20240517110932.png) 将孤岛沉没: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517110953.png) +![](https://file.kamacoder.com/pics/20240517110953.png) 数据范围: @@ -73,7 +73,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517113813.png) +![](https://file.kamacoder.com/pics/20240517113813.png) 整体C++代码如下,以下使用dfs实现,其实遍历方式dfs,bfs都是可以的。 diff --git "a/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" "b/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" index 1c646b1c03..5924cb18a9 100644 --- "a/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" +++ "b/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" @@ -48,7 +48,7 @@ 提示信息: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240517115816.png) +![](https://file.kamacoder.com/pics/20240517115816.png) 图中的蓝色方块上的雨水既能流向第一组边界,也能流向第二组边界。所以最终答案为所有蓝色方块的坐标。 @@ -166,11 +166,11 @@ int main() { 从第一组边界边上节点出发,如图: (图中并没有把所有遍历的方向都画出来,只画关键部分) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250304174747.png) +![](https://file.kamacoder.com/pics/20250304174747.png) 从第二组边界上节点出发,如图: (图中并没有把所有遍历的方向都画出来,只画关键部分) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250304174801.png) +![](https://file.kamacoder.com/pics/20250304174801.png) 最后,我们得到两个方向交界的这些节点,就是我们最后要求的节点。 diff --git "a/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" "b/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" index 5f091779d1..483d777275 100644 --- "a/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" +++ "b/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" @@ -35,12 +35,12 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240522154055.png) +![](https://file.kamacoder.com/pics/20240522154055.png) 对于上面的案例,有两个位置可将 0 变成 1,使得岛屿的面积最大,即 6。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240522154110.png) +![](https://file.kamacoder.com/pics/20240522154110.png) 数据范围: @@ -70,11 +70,11 @@ 拿如下地图的岛屿情况来举例: (1为陆地) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829104834.png) +![](https://file.kamacoder.com/pics/20220829104834.png) 第一步,则遍历地图,并将岛屿的编号和面积都统计好,过程如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829105644.png) +![](https://file.kamacoder.com/pics/20220829105644.png) 本过程代码如下: @@ -121,7 +121,7 @@ int largestIsland(vector>& grid) { 第二步过程如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220829105249.png) +![](https://file.kamacoder.com/pics/20220829105249.png) 也就是遍历每一个0的方格,并统计其相邻岛屿面积,最后取一个最大值。 diff --git "a/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" "b/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" index 6901c655e4..cfe77c0d38 100644 --- "a/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" +++ "b/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" @@ -33,7 +33,7 @@ 【提示信息】 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240522174707.png) +![](https://file.kamacoder.com/pics/20240522174707.png) 从 1 号节点可以到达任意节点,输出 1。 @@ -48,7 +48,7 @@ 接下来我们再画一个图,从图里可以直观看出来,节点6 是 不能到达节点1 的 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240522175451.png) +![](https://file.kamacoder.com/pics/20240522175451.png) 这就很容易让我们想起岛屿问题,只要发现独立的岛,就是不可到达的。 diff --git "a/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" "b/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" index 91a1a438c6..a1ef2a76eb 100644 --- "a/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" +++ "b/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" @@ -37,7 +37,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240524115244.png) +![](https://file.kamacoder.com/pics/20240524115244.png) 岛屿的周长为 14。 @@ -57,14 +57,14 @@ 如果该陆地上下左右的空格是有水域,则说明是一条边,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240524115933.png) +![](https://file.kamacoder.com/pics/20240524115933.png) 陆地的右边空格是水域,则说明找到一条边。 如果该陆地上下左右的空格出界了,则说明是一条边,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240524120105.png) +![](https://file.kamacoder.com/pics/20240524120105.png) 该陆地的下边空格出界了,则说明找到一条边。 @@ -114,7 +114,7 @@ int main() { 因为有一对相邻两个陆地,边的总数就要减2,如图红线部分,有两个陆地相邻,总边数就要减2 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240524120855.png) +![](https://file.kamacoder.com/pics/20240524120855.png) 那么只需要在计算出相邻岛屿的数量就可以了,相邻岛屿数量为cover。 diff --git "a/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" "b/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" index 779907c8fd..363a188465 100644 --- "a/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" @@ -40,7 +40,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527104432.png) +![](https://file.kamacoder.com/pics/20240527104432.png) 数据范围: diff --git "a/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" "b/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" index ae247ac025..fe641f53c9 100644 --- "a/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" +++ "b/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" @@ -9,11 +9,11 @@ 有一个图,它是一棵树,他是拥有 n 个节点(节点编号1到n)和 n - 1 条边的连通无环无向图(其实就是一个线形图),如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240905163122.png) +![](https://file.kamacoder.com/pics/20240905163122.png) 现在在这棵树上的基础上,添加一条边(依然是n个节点,但有n条边),使这个图变成了有环图,如图 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240905164721.png) +![](https://file.kamacoder.com/pics/20240905164721.png) 先请你找出冗余边,删除后,使该图可以重新变成一棵树。 @@ -42,7 +42,7 @@ 提示信息 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527110320.png) +![](https://file.kamacoder.com/pics/20240527110320.png) 图中的 1 2,2 3,1 3 等三条边在删除后都能使原图变为一棵合法的树。但是 1 3 由于是标准输入里最后出现的那条边,所以输出结果为 1 3 @@ -69,13 +69,13 @@ 如图所示,节点A 和节点 B 不在同一个集合,那么就可以将两个 节点连在一起。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230604104720.png) +![](https://file.kamacoder.com/pics/20230604104720.png) 如果边的两个节点已经出现在同一个集合里,说明着边的两个节点已经连在一起了,再加入这条边一定就出现环了。 如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230604104330.png) +![](https://file.kamacoder.com/pics/20230604104330.png) 已经判断 节点A 和 节点B 在在同一个集合(同一个根),如果将 节点A 和 节点B 连在一起就一定会出现环。 @@ -157,7 +157,7 @@ int main() { 图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527110320.png) +![](https://file.kamacoder.com/pics/20240527110320.png) 输出示例 diff --git "a/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" "b/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" index 070bc68500..78132a3256 100644 --- "a/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" +++ "b/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" @@ -9,11 +9,11 @@ 有一种有向树,该树只有一个根节点,所有其他节点都是该根节点的后继。该树除了根节点之外的每一个节点都有且只有一个父节点,而根节点没有父节点。有向树拥有 n 个节点和 n - 1 条边。如图:  - + 现在有一个有向图,有向图是在有向树中的两个没有直接链接的节点中间添加一条有向边。如图: - + 输入一个有向图,该图由一个有着 n 个节点(节点编号 从 1 到 n),n 条边,请返回一条可以删除的边,使得删除该条边之后该有向图可以被当作一颗有向树。 @@ -42,7 +42,7 @@ 提示信息 - + 在删除 2 3 后有向图可以变为一棵合法的有向树,所以输出 2 3 @@ -64,13 +64,13 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527115807.png) +![](https://file.kamacoder.com/pics/20240527115807.png) 找到了节点3 的入度为2,删 1 -> 3 或者 2 -> 3 。选择删顺序靠后便可。 但 入度为2 还有一种情况,情况二,只能删特定的一条边,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527151456.png) +![](https://file.kamacoder.com/pics/20240527151456.png) 节点3 的入度为 2,但在删除边的时候,只能删 这条边(节点1 -> 节点3),如果删这条边(节点4 -> 节点3),那么删后本图也不是有向树了(因为找不到根节点)。 @@ -81,7 +81,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240527120531.png) +![](https://file.kamacoder.com/pics/20240527120531.png) 对于情况三,删掉构成环的边就可以了。 diff --git "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" index 8bae6280bf..af3436901c 100644 --- "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" +++ "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" @@ -57,7 +57,7 @@ yhn 2 <= N <= 500

- +

@@ -65,7 +65,7 @@ yhn 以示例1为例,从这个图中可以看出 abc 到 def的路线 不止一条,但最短的一条路径上是4个节点。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250317105155.png) +![](https://file.kamacoder.com/pics/20250317105155.png) 本题只需要求出最短路径的长度就可以了,不用找出具体路径。 diff --git "a/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" "b/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" index 58c1776304..18802765a9 100644 --- "a/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" +++ "b/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" @@ -39,7 +39,7 @@ 文件依赖关系如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510192157.png) +![](https://file.kamacoder.com/pics/20240510192157.png) 所以,文件处理的顺序除了示例中的顺序,还存在 @@ -104,7 +104,7 @@ 以题目中示例为例如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510110836.png) +![](https://file.kamacoder.com/pics/20240510110836.png) 做拓扑排序的话,如果肉眼去找开头的节点,一定能找到 节点0 吧,都知道要从节点0 开始。 @@ -135,17 +135,17 @@ 1、找到入度为0 的节点,加入结果集 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113110.png) +![](https://file.kamacoder.com/pics/20240510113110.png) 2、将该节点从图中移除 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113142.png) +![](https://file.kamacoder.com/pics/20240510113142.png) ---------------- 1、找到入度为0 的节点,加入结果集 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113345.png) +![](https://file.kamacoder.com/pics/20240510113345.png) 这里大家会发现,节点1 和 节点2 入度都为0, 选哪个呢? @@ -153,19 +153,19 @@ 2、将该节点从图中移除 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113640.png) +![](https://file.kamacoder.com/pics/20240510113640.png) --------------- 1、找到入度为0 的节点,加入结果集 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113853.png) +![](https://file.kamacoder.com/pics/20240510113853.png) 节点2 和 节点3 入度都为0,选哪个都行,这里选节点2 2、将该节点从图中移除 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510114004.png) +![](https://file.kamacoder.com/pics/20240510114004.png) -------------- @@ -177,7 +177,7 @@ 如果有 有向环怎么办呢?例如这个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510115115.png) +![](https://file.kamacoder.com/pics/20240510115115.png) 这个图,我们只能将入度为0 的节点0 接入结果集。 @@ -252,13 +252,13 @@ while (que.size()) { 如果这里不理解,看上面的模拟过程第一步: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113110.png) +![](https://file.kamacoder.com/pics/20240510113110.png) 这事节点1 和 节点2 的入度为 1。 将节点0删除后,图为这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510113142.png) +![](https://file.kamacoder.com/pics/20240510113142.png) 那么 节点0 作为出发点 所连接的节点的入度 就都做了 减一 的操作。 diff --git "a/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" "b/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" index 8ad3264433..7d0096d52d 100644 --- "a/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" +++ "b/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" @@ -9,7 +9,7 @@ 骑士移动规则如图,红色是起始位置,黄色是骑士可以走的地方。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240626104833.png) +![](https://file.kamacoder.com/pics/20240626104833.png) 棋盘大小 1000 x 1000(棋盘的 x 和 y 坐标均在 [1, 1000] 区间内,包含边界) @@ -108,7 +108,7 @@ int main() 我们来看一下广搜的搜索过程,如图,红色是起点,绿色是终点,黄色是要遍历的点,最后从 起点 找到 达到终点的最短路径是棕色。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240611143712.png) +![](https://file.kamacoder.com/pics/20240611143712.png) 可以看出 广搜中,做了很多无用的遍历, 黄色的格子是广搜遍历到的点。 @@ -131,11 +131,11 @@ Astar 是一种 广搜的改良版。 有的是 Astar是 dijkstra 的改良版 在BFS中,我们想搜索,从起点到终点的最短路径,要一层一层去遍历。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240611143712.png) +![](https://file.kamacoder.com/pics/20240611143712.png) 如果 使用A * 的话,其搜索过程是这样的,如图,图中着色的都是我们要遍历的点。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240611195223.png) +![](https://file.kamacoder.com/pics/20240611195223.png) (上面两图中 最短路长度都是8,只是走的方式不同而已) diff --git "a/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" index e463b95600..5eb5127a93 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -105,13 +105,13 @@ bool isSame(int u, int v) { 搜索过程像是一个多叉树中从叶子到根节点的过程,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230602102619.png) +![](https://file.kamacoder.com/pics/20230602102619.png) 如果这棵多叉树高度很深的话,每次find函数 去寻找根的过程就要递归很多次。 我们的目的只需要知道这些节点在同一个根下就可以,所以对这棵多叉树的构造只需要这样就可以了,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230602103040.png) +![](https://file.kamacoder.com/pics/20230602103040.png) 除了根节点其他所有节点都挂载根节点下,这样我们在寻根的时候就很快,只需要一步, @@ -226,7 +226,7 @@ join(3, 2); 此时构成的图是这样的: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230525111307.png) +![](https://file.kamacoder.com/pics/20230525111307.png) 此时问 1,3是否在同一个集合,我们调用 `join(1, 2); join(3, 2);` 很明显本意要表示 1,3是在同一个集合。 @@ -256,7 +256,7 @@ join(3, 2); 构成的图是这样的: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230525112101.png) +![](https://file.kamacoder.com/pics/20230525112101.png) 因为在join函数里,我们有find函数进行寻根的过程,这样就保证元素 1,2,3在这个有向图里是强连通的。 @@ -275,12 +275,12 @@ join(3, 2); 1、`join(1, 8);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122112727.png) +![](https://file.kamacoder.com/pics/20231122112727.png) 2、`join(3, 8);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122113857.png) +![](https://file.kamacoder.com/pics/20231122113857.png) 有录友可能想,`join(3, 8)` 在图中为什么 将 元素1 连向元素 3 而不是将 元素 8 连向 元素 3 呢? @@ -288,12 +288,12 @@ join(3, 2); 3、`join(1, 7);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122114108.png) +![](https://file.kamacoder.com/pics/20231122114108.png) 4、`join(8, 5);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122114847.png) +![](https://file.kamacoder.com/pics/20231122114847.png) 这里8的根是3,那么 5 应该指向 8 的根 3,这里的原因,我们在上面「常见误区」已经讲过了。 但 为什么 图中 8 又直接指向了 3 了呢? @@ -310,11 +310,11 @@ int find(int u) { 5、`join(2, 9);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122115000.png) +![](https://file.kamacoder.com/pics/20231122115000.png) 6、`join(6, 9);` -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231122115404.png) +![](https://file.kamacoder.com/pics/20231122115404.png) 这里为什么是 2 指向了 6,因为 9的根为 2,所以用2指向6。 @@ -347,13 +347,13 @@ rank表示树的高度,即树中结点层次的最大值。 例如两个集合(多叉树)需要合并,如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230602172250.png) +![](https://file.kamacoder.com/pics/20230602172250.png) 树1 rank 为2,树2 rank 为 3。那么合并两个集合,是 树1 合入 树2,还是 树2 合入 树1呢? 我们来看两个不同方式合入的效果。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20230602172933.png) +![](https://file.kamacoder.com/pics/20230602172933.png) 这里可以看出,树2 合入 树1 会导致整棵树的高度变的更高,而 树1 合入 树2 整棵树的高度 和 树2 保持一致。 diff --git "a/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" index d791d2c0ff..96e313fc42 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -18,11 +18,11 @@ 我们用一个方格地图,假如每次搜索的方向为 上下左右(不包含斜上方),那么给出一个start起始位置,那么BFS就是从四个方向走出第一步。 -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220825104505.png) +![图一](https://file.kamacoder.com/pics/20220825104505.png) 如果加上一个end终止位置,那么使用BFS的搜索过程如图所示: -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220825102653.png) +![图二](https://file.kamacoder.com/pics/20220825102653.png) 我们从图中可以看出,从start起点开始,是一圈一圈,向外搜索,方格编号1为第一步遍历的节点,方格编号2为第二步遍历的节点,第四步的时候我们找到终止点end。 @@ -30,7 +30,7 @@ 而且地图还可以有障碍,如图所示: -![图三](https://code-thinking-1253855093.file.myqcloud.com/pics/20220825103900.png) +![图三](https://file.kamacoder.com/pics/20220825103900.png) 在第五步,第六步 我只把关键的节点染色了,其他方向周边没有去染色,大家只要关注关键地方染色的逻辑就可以。 diff --git "a/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" index ce3dbbdbe7..1611e00aa0 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -28,29 +28,29 @@ 如图一,是一个无向图,我们要搜索从节点1到节点6的所有路径。 -![图一](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707093643.png) +![图一](https://file.kamacoder.com/pics/20220707093643.png) 那么dfs搜索的第一条路径是这样的: (假设第一次延默认方向,就找到了节点6),图二 -![图二](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707093807.png) +![图二](https://file.kamacoder.com/pics/20220707093807.png) 此时我们找到了节点6,(遇到黄河了,是不是应该回头了),那么应该再去搜索其他方向了。 如图三: -![图三](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707094011.png) +![图三](https://file.kamacoder.com/pics/20220707094011.png) 路径2撤销了,改变了方向,走路径3(红色线), 接着也找到终点6。 那么撤销路径2,改为路径3,在dfs中其实就是回溯的过程(这一点很重要,很多录友不理解dfs代码中回溯是用来干什么的) 又找到了一条从节点1到节点6的路径,又到黄河了,此时再回头,下图图四中,路径4撤销(回溯的过程),改为路径5。 -![图四](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707094322.png) +![图四](https://file.kamacoder.com/pics/20220707094322.png) 又找到了一条从节点1到节点6的路径,又到黄河了,此时再回头,下图图五,路径6撤销(回溯的过程),改为路径7,路径8 和 路径7,路径9, 结果发现死路一条,都走到了自己走过的节点。 -![图五](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707094813.png) +![图五](https://file.kamacoder.com/pics/20220707094813.png) 那么节点2所连接路径和节点3所链接的路径 都走过了,撤销路径只能向上回退,去选择撤销当初节点4的选择,也就是撤销路径5,改为路径10 。 如图图六: -![图六](https://code-thinking-1253855093.file.myqcloud.com/pics/20220707095232.png) +![图六](https://file.kamacoder.com/pics/20220707095232.png) 上图演示中,其实我并没有把 所有的 从节点1 到节点6的dfs(深度优先搜索)的过程都画出来,那样太冗余了,但 已经把dfs 关键的地方都涉及到了,关键就两点: @@ -180,7 +180,7 @@ for (选择:本节点所连接的其他节点) { 如图七所示, 路径2 已经走到了 目的地节点6,那么 路径2 是如何撤销,然后改为 路径3呢? 其实这就是 回溯的过程,撤销路径2,走换下一个方向。 -![图七](https://code-thinking-1253855093.file.myqcloud.com/pics/20220708093544.png) +![图七](https://file.kamacoder.com/pics/20220708093544.png) ## 总结 diff --git "a/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" index 84f693a00b..9bec322765 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -17,15 +17,15 @@ 有向图是指 图中边是有方向的: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510195737.png) +![](https://file.kamacoder.com/pics/20240510195737.png) 无向图是指 图中边没有方向: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510195451.png) +![](https://file.kamacoder.com/pics/20240510195451.png) 加权有向图,就是图中边是有权值的,例如: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240510195821.png) +![](https://file.kamacoder.com/pics/20240510195821.png) 加权无向图也是同理。 @@ -35,7 +35,7 @@ 例如,该无向图中,节点4的度为5,节点6的度为3。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511115029.png) +![](https://file.kamacoder.com/pics/20240511115029.png) 在有向图中,每个节点有出度和入度。 @@ -45,7 +45,7 @@ 例如,该有向图中,节点3的入度为2,出度为1,节点1的入度为0,出度为2。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511115235.png) +![](https://file.kamacoder.com/pics/20240511115235.png) ## 连通性 @@ -56,11 +56,11 @@ 在无向图中,任何两个节点都是可以到达的,我们称之为连通图 ,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511102351.png) +![](https://file.kamacoder.com/pics/20240511102351.png) 如果有节点不能到达其他节点,则为非连通图,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511102449.png) +![](https://file.kamacoder.com/pics/20240511102449.png) 节点1 不能到达节点4。 @@ -72,7 +72,7 @@ 我们来看这个有向图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511104531.png) +![](https://file.kamacoder.com/pics/20240511104531.png) 这个图是强连通图吗? @@ -82,7 +82,7 @@ 下面这个有向图才是强连通图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511113101.png) +![](https://file.kamacoder.com/pics/20240511113101.png) ### 连通分量 @@ -91,7 +91,7 @@ 只看概念大家可能不理解,我来画个图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511111559.png) +![](https://file.kamacoder.com/pics/20240511111559.png) 该无向图中 节点1、节点2、节点5 构成的子图就是 该无向图中的一个连通分量,该子图所有节点都是相互可达到的。 @@ -111,7 +111,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511112951.png) +![](https://file.kamacoder.com/pics/20240511112951.png) 节点1、节点2、节点3、节点4、节点5 构成的子图是强连通分量,因为这是强连通图,也是极大图。 @@ -132,11 +132,11 @@ 例如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240511112951.png) +![](https://file.kamacoder.com/pics/20240511112951.png) 图中有8条边,我们就定义 8 * 2的数组,即有n条边就申请n * 2,这么大的数组: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20250110114348.png) +![](https://file.kamacoder.com/pics/20250110114348.png) 数组第一行:6 7,就表示节点6 指向 节点7,以此类推。 @@ -162,7 +162,7 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240222110025.png) +![](https://file.kamacoder.com/pics/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间。 @@ -188,7 +188,7 @@ 邻接表的构造如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240223103713.png) +![](https://file.kamacoder.com/pics/20240223103713.png) 这里表达的图是: diff --git "a/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" "b/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" index 54f9153900..e83880dab1 100644 --- "a/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" @@ -17,7 +17,7 @@ 最短路算法比较复杂,而且各自有各自的应用场景,我来用一张表把讲过的最短路算法的使用场景都展现出来: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240508121355.png) +![](https://file.kamacoder.com/pics/20240508121355.png) (因为A * 属于启发式搜索,和上面最短路算法并不是一类,不适合一起对比,所以没有放在一起) diff --git a/problems/qita/acm.md b/problems/qita/acm.md index 999283564a..33dcd8a652 100644 --- a/problems/qita/acm.md +++ b/problems/qita/acm.md @@ -11,15 +11,15 @@ [知识星球](https://programmercarl.com/other/kstar.html)里很多录友的日常打卡中,都表示被 ACM模式折磨过: -
+
-
+
-
+
-
+
-
+
所以我正式推出:**卡码网**([https://kamacoder.com](https://kamacoder.com)),**专门帮助大家练习ACM模式**。 @@ -43,17 +43,17 @@ 来看看这极简的界面,没有烂七八糟的功能,只有刷题! -
+
在「状态」这里可以看到 大家提交的代码和判题记录,目前卡码网([https://kamacoder.com](https://kamacoder.com))几乎无时无刻都有卡友在提交代码。 看看大家周六晚上都在做什么,刷哪些题目。 -
+
提交代码的界面是这样的,**目前支持所有主流刷题语言**。 -
+
## 题解 @@ -63,7 +63,7 @@ [https://github.com/youngyangyang04/kamacoder-solutions](https://github.com/youngyangyang04/kamacoder-solutions) -
+
**欢迎去Github上star,欢迎fork,也欢迎来Github仓库贡献其他语言版本,成为contributor**。 @@ -71,7 +71,7 @@ 目前已经有两位录友贡献C和Java版本了。 -
+
期待在Github(https://github.com/youngyangyang04/kamacoder-solutions) 的contributors上也出现你的头像。 diff --git a/problems/qita/join.md b/problems/qita/join.md index c7e17588bf..027b81726a 100644 --- a/problems/qita/join.md +++ b/problems/qita/join.md @@ -28,10 +28,10 @@ 点击这里Fetch upstream。 -
+
点击之后,这里就会显示最新的信息了 -
+
注意这时是你的远端仓库为最新版本,本地还不是最新的,本地要git pull一下。 @@ -39,18 +39,18 @@ 如何提交代码呢,首先把自己的代码提交到自己的fork的远端仓库中,然后open pull request,如图: -
+
点击 open pull request之后,就是如下画面,一个pull request有多个commit。 -
+
然后就是给pull request 添加备注,pull request是对本次commit的一个总结。如果一个pull request就一个commit,那么就和commit的备注保持一次。 然后点击 create pull request 就可以了 -
+
此时你就提交成功了,我会在项目中的pull requests 处理列表里看到你的请求。 -
+
然后如果你发现自己的代码没有合入多半是有问题,如果有问题都有会在pull request里给出留言的, @@ -78,27 +78,27 @@ C++代码 \`\`\` 例如这个commit,在添加java代码的时候,就直接添加代码 -
+
正确的格式应该是这样: -
+
一般发现问题,我也会在代码中给出评论: -
+
这样大家也可以学习一些 提交代码的规范方面的知识 有的录友 是添加的代码块语法,但没有标记是哪种语言,这样的话 代码就不会针对某种语言高亮显示了,也比较影响阅读,例如: -
+
提交python代码的话,要注释好,是python2还是python3 例如这样: -
+
当然python2的话,只这么写就行 @@ -113,7 +113,7 @@ python代码 有的录友是一个pull request 里只有一个commit。 -
+
其实如果大家是平时一天写了两三道题目的话,那么分三个commit,一个pull request提交上来就行。 @@ -127,13 +127,13 @@ python代码 例如这位录友,在提交Java代码的时候,按照题解的意思对Java版本的代码进行的注释,这就很棒👍 -
+
-
+
当然如果大家感觉 已有的代码 不符合以上要求的话,例如 代码思路不够清晰不够规范,注释不够友好,依然欢迎提交优化代码,要记得详细注释哦。 -
+
### 说明具体是哪种方法 @@ -141,10 +141,10 @@ python代码 下面这位录友做的就很好 -
+
-
+
有的题解,是一起给出了多道题目的讲解,例如项目中0102.二叉树的层序遍历.md 中有八道题目,那么大家添加代码的时候 应该在代码注释上,或者 直接写上 是哪个题目的代码。 @@ -162,7 +162,7 @@ python代码 有一位录友在提交代码的时候会把之前的代码 做一下规范性的调整,这就很棒。 -
+
**代码规范从你我做起!** @@ -183,10 +183,10 @@ python代码 在合入的过程中还要处理冲突的代码, 理解大家代码的思路,解决冲突,然后在力扣提交一下,确保是没问题。 例如同一道题目, 一位录友提交了, 我还没处理如何,另一位录友也对这道题也提交了代码,这样就会发生冲突 -
+
大家提交代码的热情太高了,我有时候根本处理不过来,但我必须当天处理完,否则第二天代码冲突会越来越多。 -
+
一天晚上分别有两位录友提交了 30多道 java代码,全部冲突,解决冲突处理的我脖子疼[哭] @@ -201,11 +201,11 @@ python代码 确保这种额外文件不要提交。 -
+
还有添加不同方法的时候,直接用正文格式写,哪种方法就可以了,不要添加目录 ,例如这样,这样整篇文章目录结构就有影响了。 -
+
前面不要加 `## 前序遍历(迭代法)`,直接写`前序遍历(迭代法)`就可以了。 @@ -233,11 +233,11 @@ Go语言代码 甚至发现哪里有语病,也欢迎提交PR来修改,例如下面:就是把【下表】 纠正为【下标】 -
+
不用非要写出牛逼的代码才能提交PR,只要发现 文章中有任何问题,或者错别字,都欢迎提交PR,成为contributor。 -
+
## 特别注意 diff --git a/problems/qita/server.md b/problems/qita/server.md index 7e214d7993..72476f5754 100644 --- a/problems/qita/server.md +++ b/problems/qita/server.md @@ -51,7 +51,7 @@ 操作方式这样,我把命令包 包装成一个shell命令,想传那个文件,直接 uploadtomyserver,然后就返回可以下载的链接,这个文件也同时传到了我的服务器上。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211126165643.png) +![](https://file.kamacoder.com/pics/20211126165643.png) 我也把我的项目代码放在了github上: @@ -93,11 +93,11 @@ https://github.com/youngyangyang04/fileHttpServer 就是这样一个非常普通的查询页面。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211126160200.png) +![](https://file.kamacoder.com/pics/20211126160200.png) 查询通过之后,就会展现返现群二维码。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211127160558.png) +![](https://file.kamacoder.com/pics/20211127160558.png) 但要部署在服务器上,因为没有公网IP,别人用不了你的服务。 diff --git a/problems/qita/shejimoshi.md b/problems/qita/shejimoshi.md index d5342c6132..07d5540a25 100644 --- a/problems/qita/shejimoshi.md +++ b/problems/qita/shejimoshi.md @@ -7,11 +7,11 @@ 所以卡码网 针对 23种设计,**推出了 23道编程题目,来帮助大家练习设计模式**。 -
+
这里的23到编程题目对应了 23种这几模式。 例如第一题,小明的购物车,就是单例模式: -
+
区别于网上其他教程,本教程的特点是: @@ -40,18 +40,18 @@ 同时还给全部整理到PDF上,这份PDF,我们写的很用心了,来个大家截个图: -
+
-
+
-
+
-
+
关于设计模式的题目,大家现在就可以去 卡码网(kamacoder)去做了。 关于这23道题目对应 设计模式精讲 PDF,也免费分享给录友们,大家可以加我的企业微信获取: -
+
已经有我企业微信的录友,直接发:设计模式,这四个字就好,我会直接发你。 diff --git a/problems/qita/tulunfabu.md b/problems/qita/tulunfabu.md index 28ee463850..b45b790d81 100644 --- a/problems/qita/tulunfabu.md +++ b/problems/qita/tulunfabu.md @@ -8,7 +8,7 @@ 我知道录友们在等图论等太久了,其实我比大家都着急。 -![大家一直都在催](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613105618.png) +![大家一直都在催](https://file.kamacoder.com/pics/20240613105618.png) 图论完整版目前已经开放在代码随想录网站:programmercarl.com @@ -20,7 +20,7 @@ * 拓扑排序 * 最短路算法 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613104436.png) +![](https://file.kamacoder.com/pics/20240613104436.png) **耗时一年之久,代码随想录图论 终于面世了**! @@ -32,21 +32,21 @@ 随便截一些图,大家感受一下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613104703.png) +![](https://file.kamacoder.com/pics/20240613104703.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613104824.png) +![](https://file.kamacoder.com/pics/20240613104824.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613104852.png) +![](https://file.kamacoder.com/pics/20240613104852.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613104926.png) +![](https://file.kamacoder.com/pics/20240613104926.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613105007.png) +![](https://file.kamacoder.com/pics/20240613105007.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613105030.png) +![](https://file.kamacoder.com/pics/20240613105030.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613105106.png) +![](https://file.kamacoder.com/pics/20240613105106.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240613105143.png) +![](https://file.kamacoder.com/pics/20240613105143.png) 具体内容,大家可以去代码随想录网站(programmercarl.com)去看看,非常精彩! @@ -203,19 +203,19 @@ cout << result[result.size() - 1]; 当大家通过 代码随想录 提升了编程与算法能力,考上研或者找到好工作的时候,于我来说已经是很幸福的事情: -![对笔试帮助大](https://code-thinking-1253855093.file.myqcloud.com/pics/20230914172536.png) +![对笔试帮助大](https://file.kamacoder.com/pics/20230914172536.png) -![华为od将近满分](https://code-thinking-1253855093.file.myqcloud.com/pics/20230914172607.png) +![华为od将近满分](https://file.kamacoder.com/pics/20230914172607.png) -![研究生复试](https://code-thinking-1253855093.file.myqcloud.com/pics/20240621103130.png) +![研究生复试](https://file.kamacoder.com/pics/20240621103130.png) -![红包感谢代码随想录366](https://code-thinking-1253855093.file.myqcloud.com/pics/20231123151310.png) +![红包感谢代码随想录366](https://file.kamacoder.com/pics/20231123151310.png) -![上岸亚马逊](https://code-thinking-1253855093.file.myqcloud.com/pics/20240206174151.png) +![上岸亚马逊](https://file.kamacoder.com/pics/20240206174151.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220718094112.png) +![](https://file.kamacoder.com/pics/20220718094112.png) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20220718094332.png) +![](https://file.kamacoder.com/pics/20220718094332.png) 至此**图论内容 已完全免费开放在代码随想录网站(programmercarl.com),造福广大学习编程的录友们**! diff --git "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" index f4d093d638..a67cf5db9d 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" @@ -147,7 +147,7 @@ 二叉树专题汇聚为一张图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211030125421.png) +![](https://file.kamacoder.com/pics/20211030125421.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[青](https://wx.zsxq.com/dweb2/index/footprint/185251215558842),所画,总结的非常好,分享给大家。 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" index 9a63b66cfd..1fbbc9d934 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -15,7 +15,7 @@ 题目分类大纲如下: -二叉树大纲 +二叉树大纲 说到二叉树,大家对于二叉树其实都很熟悉了,本文呢我也不想教科书式的把二叉树的基础内容再啰嗦一遍,所以以下我讲的都是一些比较重点的内容。 @@ -31,7 +31,7 @@ 如图所示: - + 这棵二叉树为满二叉树,也可以说深度为k,有2^k-1个节点的二叉树。 @@ -46,7 +46,7 @@ 我来举一个典型的例子如题: - + 相信不少同学最后一个二叉树是不是完全二叉树都中招了。 @@ -63,7 +63,7 @@ 下面这两棵树都是搜索树 - + ### 平衡二叉搜索树 @@ -72,7 +72,7 @@ 如图: - + 最后一棵 不是平衡二叉树,因为它的左右两个子树的高度差的绝对值超过了1。 @@ -91,13 +91,13 @@ 链式存储如图: - + 链式存储是大家很熟悉的一种方式,那么我们来看看如何顺序存储呢? 其实就是用数组来存储二叉树,顺序存储的方式如图: - + 用数组来存储二叉树如何遍历的呢? @@ -144,7 +144,7 @@ 大家可以对着如下图,看看自己理解的前后中序有没有问题。 - + 最后再说一说二叉树中深度优先和广度优先遍历实现方式,我们做二叉树相关题目,经常会使用递归的方式来实现深度优先遍历,也就是实现前中后序遍历,使用递归是比较方便的。 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" index 289c651b60..e011612ca6 100644 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" @@ -117,7 +117,7 @@ public: 再来看后序遍历,先序遍历是中左右,后序遍历是左右中,那么我们只需要调整一下先序遍历的代码顺序,就变成中右左的遍历顺序,然后在反转result数组,输出的结果顺序就是左右中了,如下图: -![前序到后序](https://code-thinking-1253855093.file.myqcloud.com/pics/20200808200338924.png) +![前序到后序](https://file.kamacoder.com/pics/20200808200338924.png) **所以后序遍历只需要前序遍历的代码稍作修改就可以了,代码如下:** diff --git "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" index 313264fba2..f1ff3a5ffc 100644 --- "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" +++ "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" @@ -5,15 +5,15 @@ 平时大家在力扣上刷题,就是 核心代码模式,即给你一个函数,直接写函数实现,例如这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231109193631.png) +![](https://file.kamacoder.com/pics/20231109193631.png) 而ACM模式,是程序头文件,main函数,数据的输入输出都要自己处理,例如这样: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231109193743.png) +![](https://file.kamacoder.com/pics/20231109193743.png) 大家可以发现 右边代码框什么都没有,程序从头到尾都需要自己实现,本题如果写完代码是这样的: (细心的录友可以发现和力扣上刷题是不一样的) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231109193931.png) +![](https://file.kamacoder.com/pics/20231109193931.png) **如果大家从一开始学习算法就一直在力扣上的话,突然切到ACM模式会非常不适应**。 @@ -21,15 +21,15 @@ 知识星球里也有很多录友,因为不熟悉ACM模式在面试的过程中吃了不少亏。 -
+
-
+
-
+
-
+
-
+
## 面试究竟怎么考? @@ -53,7 +53,7 @@ 你只要能把卡码网首页的25道题目 都刷了 ,就把所有的ACM输入输出方式都练习到位了,不会有任何盲区。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231109195056.png) +![](https://file.kamacoder.com/pics/20231109195056.png) 而且你不用担心,题目难度太大,直接给自己劝退,**卡码网的前25道题目都是我精心制作的,难度也是循序渐进的**,大家去刷一下就知道了。 diff --git "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" index 48781eda88..086e6e0ea0 100644 --- "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" @@ -15,7 +15,7 @@ 其输入用例,就是用一个数组来表述 二叉树,如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914222335.png) +![](https://file.kamacoder.com/pics/20210914222335.png) 一直跟着公众号学算法的录友 应该知道,我在[二叉树:构造二叉树登场!](https://mp.weixin.qq.com/s/Dza-fqjTyGrsRw4PWNKdxA),已经讲过,**只有 中序与后序 和 中序和前序 可以确定一棵唯一的二叉树。 前序和后序是不能确定唯一的二叉树的**。 @@ -24,7 +24,7 @@ 很明显,是后台直接明确了构造规则。 再看一下 这个 输入序列 和 对应的二叉树。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914222335.png) +![](https://file.kamacoder.com/pics/20210914222335.png) 从二叉树 推导到 序列,大家可以发现这就是层序遍历。 @@ -36,7 +36,7 @@ 顺序存储,就是用一个数组来存二叉树,其方式如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914223147.png) +![](https://file.kamacoder.com/pics/20210914223147.png) 那么此时大家是不是应该知道了,数组如何转化成 二叉树了。**如果父节点的数组下标是i,那么它的左孩子下标就是i * 2 + 1,右孩子下标就是 i * 2 + 2**。 @@ -80,7 +80,7 @@ TreeNode* construct_binary_tree(const vector& vec) { 这个函数最后返回的 指针就是 根节点的指针, 这就是 传入二叉树的格式了,也就是 力扣上的用例输入格式,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914224422.png) +![](https://file.kamacoder.com/pics/20210914224422.png) 也有不少同学在做ACM模式的题目,就经常疑惑: @@ -176,7 +176,7 @@ int main() { 和 [538.把二叉搜索树转换为累加树](https://mp.weixin.qq.com/s/rlJUFGCnXsIMX0Lg-fRpIw) 中的输入是一样的 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914222335.png) +![](https://file.kamacoder.com/pics/20210914222335.png) 这里可能又有同学疑惑,你这不一样啊,题目是null,你为啥用-1。 @@ -184,11 +184,11 @@ int main() { 在来看,测试代码输出的效果: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914230045.png) +![](https://file.kamacoder.com/pics/20210914230045.png) 可以看出和 题目中输入用例 这个图 是一样一样的。 只不过题目中图没有把 空节点 画出来而已。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210914230118.png) +![](https://file.kamacoder.com/pics/20210914230118.png) 大家可以拿我的代码去测试一下,跑一跑。 @@ -205,7 +205,7 @@ int main() { **[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)**里有的录友已经开始三刷: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20210727234031.png) +![](https://file.kamacoder.com/pics/20210727234031.png) 只做过一遍,真的就是懂了一点皮毛, 第二遍刷才有真的对各个题目有较为深入的理解,也会明白 我为什么要这样安排刷题的顺序了。 diff --git "a/problems/\345\211\215\345\272\217/vim.md" "b/problems/\345\211\215\345\272\217/vim.md" index 581019995a..13935b91c6 100644 --- "a/problems/\345\211\215\345\272\217/vim.md" +++ "b/problems/\345\211\215\345\272\217/vim.md" @@ -93,7 +93,7 @@ sh install.sh 当然 还有很多,我还详细写了PowerVim的快捷键,使用方法,插件,配置,等等,都在Github主页的README上。当时我的Github上写的都是英文README,这次为了方便大家阅读,我又翻译成中文README。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211013102249.png) +![](https://file.kamacoder.com/pics/20211013102249.png) Github地址:[https://github.com/youngyangyang04/PowerVim](https://github.com/youngyangyang04/PowerVim) diff --git "a/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" "b/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" index 95f4f129da..33891632b8 100644 --- "a/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" +++ "b/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" @@ -57,7 +57,7 @@ 我做了一下总结如图: -![编程风格](https://code-thinking-1253855093.file.myqcloud.com/pics/20201119173039835.png) +![编程风格](https://file.kamacoder.com/pics/20201119173039835.png) ### 水平留白(代码空格) diff --git "a/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" "b/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" index f70564e4a2..88fb129ee2 100644 --- "a/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" +++ "b/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" @@ -19,7 +19,7 @@ 如果我们写C++的程序,就要知道栈和堆的概念,程序运行时所需的内存空间分为 固定部分,和可变部分,如下: -![C++内存空间](https://code-thinking-1253855093.file.myqcloud.com/pics/20210309165950660.png) +![C++内存空间](https://file.kamacoder.com/pics/20210309165950660.png) 固定部分的内存消耗 是不会随着代码运行产生变化的, 可变部分则是会产生变化的 @@ -41,7 +41,7 @@ 想要算出自己程序会占用多少内存就一定要了解自己定义的数据类型的大小,如下: -![C++数据类型的大小](https://code-thinking-1253855093.file.myqcloud.com/pics/20200804193045440.png) +![C++数据类型的大小](https://file.kamacoder.com/pics/20200804193045440.png) 注意图中有两个不一样的地方,为什么64位的指针就占用了8个字节,而32位的指针占用4个字节呢? @@ -109,7 +109,7 @@ CPU读取内存不是一次读取单个字节,而是一块一块的来读取 第一种就是内存对齐的情况,如图: -![内存对齐](https://code-thinking-1253855093.file.myqcloud.com/pics/20200804193307347.png) +![内存对齐](https://file.kamacoder.com/pics/20200804193307347.png) 一字节的char占用了四个字节,空了三个字节的内存地址,int数据从地址4开始。 @@ -117,7 +117,7 @@ CPU读取内存不是一次读取单个字节,而是一块一块的来读取 第二种是没有内存对齐的情况如图: -![非内存对齐](https://code-thinking-1253855093.file.myqcloud.com/pics/20200804193353926.png) +![非内存对齐](https://file.kamacoder.com/pics/20200804193353926.png) char型的数据和int型的数据挨在一起,该int数据从地址1开始,那么CPU想要读这个数据的话来看看需要几步操作: diff --git "a/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" "b/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" index 61f0a7ef6a..045646ff7e 100644 --- "a/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" +++ "b/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" @@ -38,7 +38,7 @@ 同样的同理再看一下快速排序,都知道快速排序是O(nlogn),但是当数据已经有序情况下,快速排序的时间复杂度是O(n^2) 的,**所以严格从大O的定义来讲,快速排序的时间复杂度应该是O(n^2)**。 **但是我们依然说快速排序是O(nlogn)的时间复杂度,这个就是业内的一个默认规定,这里说的O代表的就是一般情况,而不是严格的上界**。如图所示: -![时间复杂度4,一般情况下的时间复杂度](https://code-thinking-1253855093.file.myqcloud.com/pics/20200728185745611-20230310123844306.png) +![时间复杂度4,一般情况下的时间复杂度](https://file.kamacoder.com/pics/20200728185745611-20230310123844306.png) 我们主要关心的还是一般情况下的数据形式。 @@ -49,7 +49,7 @@ 如下图中可以看出不同算法的时间复杂度在不同数据输入规模下的差异。 -![时间复杂度,不同数据规模的差异](https://code-thinking-1253855093.file.myqcloud.com/pics/20200728191447384-20230310124015324.png) +![时间复杂度,不同数据规模的差异](https://file.kamacoder.com/pics/20200728191447384-20230310124015324.png) 在决定使用哪些算法的时候,不是时间复杂越低的越好(因为简化后的时间复杂度忽略了常数项等等),要考虑数据规模,如果数据规模很小甚至可以用O(n^2)的算法比O(n)的更合适(在有常数项的时候)。 @@ -115,7 +115,7 @@ O(2 × n^2 + 10 × n + 1000) < O(3 × n^2),所以说最后省略掉常数项 为什么可以这么做呢?如下图所示: -![时间复杂度1.png](https://code-thinking-1253855093.file.myqcloud.com/pics/20200728191447349-20230310124032001.png) +![时间复杂度1.png](https://file.kamacoder.com/pics/20200728191447349-20230310124032001.png) 假如有两个算法的时间复杂度,分别是log以2为底n的对数和log以10为底n的对数,那么这里如果还记得高中数学的话,应该不难理解`以2为底n的对数 = 以2为底10的对数 * 以10为底n的对数`。 diff --git "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" index 7fbfa1fd2b..1bdcccd586 100644 --- "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" +++ "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" @@ -103,13 +103,13 @@ Carl校招社招都拿过大厂的offer,同时也看过很多应聘者的简 最后福利,把我的简历模板贡献出来!如下图所示。 -![简历模板](https://code-thinking-1253855093.file.myqcloud.com/pics/20200803175538158.png) +![简历模板](https://file.kamacoder.com/pics/20200803175538158.png) 这里是简历模板中Markdown的代码:[https://github.com/youngyangyang04/Markdown-Resume-Template](https://github.com/youngyangyang04/Markdown-Resume-Template) ,可以fork到自己Github仓库上,按照这个模板来修改自己的简历。 **Word版本的简历,添加如下企业微信,通过之后就会发你word版本**。 -
+
如果已经有我的企业微信,直接回复:简历模板,就可以了。 diff --git "a/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" "b/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" index 34ebe6deb1..ca1a422c0b 100644 --- "a/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" +++ "b/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" @@ -8,7 +8,7 @@ ## 超时是怎么回事 -![程序超时](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729112716117-20230310124308704.png) +![程序超时](https://file.kamacoder.com/pics/20200729112716117-20230310124308704.png) 大家在leetcode上练习算法的时候应该都遇到过一种错误是“超时”。 @@ -124,11 +124,11 @@ int main() { 来看一下运行的效果,如下图: -![程序超时2](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729200018460-20230310124315093.png) +![程序超时2](https://file.kamacoder.com/pics/20200729200018460-20230310124315093.png) O(n)的算法,1s内大概计算机可以运行 5 * (10^8)次计算,可以推测一下 $O(n^2)$ 的算法应该1s可以处理的数量级的规模是 5 * (10^8)开根号,实验数据如下。 -![程序超时3](https://code-thinking-1253855093.file.myqcloud.com/pics/2020072919590970-20230310124318532.png) +![程序超时3](https://file.kamacoder.com/pics/2020072919590970-20230310124318532.png) O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚刚的推测。 @@ -136,7 +136,7 @@ O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚 理论上应该是比 $O(n)$ 少一个数量级,因为 $\log n$ 的复杂度 其实是很快,看一下实验数据。 -![程序超时4](https://code-thinking-1253855093.file.myqcloud.com/pics/20200729195729407-20230310124322232.png) +![程序超时4](https://file.kamacoder.com/pics/20200729195729407-20230310124322232.png) $O(n\log n)$ 的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符合预期。 @@ -144,7 +144,7 @@ $O(n\log n)$ 的算法,1s内大概计算机可以运行 2 * (10^7)次计算, **整体测试数据整理如下:** -![程序超时1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201208231559175-20230310124325152.png) +![程序超时1](https://file.kamacoder.com/pics/20201208231559175-20230310124325152.png) 至于 $O(\log n)$ 和 $O(n^3)$ 等等这些时间复杂度在1s内可以处理的多大的数据规模,大家可以自己写一写代码去测一下了。 diff --git "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" index 39513a9155..035399ce0f 100644 --- "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" +++ "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" @@ -29,7 +29,7 @@ int fibonacci(int i) { 可以看出上面的代码每次递归都是O(1)的操作。再来看递归了多少次,这里将i为5作为输入的递归过程 抽象成一棵递归树,如图: -![递归空间复杂度分析](https://code-thinking-1253855093.file.myqcloud.com/pics/20210305093200104.png) +![递归空间复杂度分析](https://file.kamacoder.com/pics/20210305093200104.png) 从图中,可以看出f(5)是由f(4)和f(3)相加而来,那么f(4)是由f(3)和f(2)相加而来 以此类推。 @@ -196,7 +196,7 @@ int main() 在看递归的深度是多少呢?如图所示: -![递归空间复杂度分析](https://code-thinking-1253855093.file.myqcloud.com/pics/20210305094749554.png) +![递归空间复杂度分析](https://file.kamacoder.com/pics/20210305094749554.png) 递归第n个斐波那契数的话,递归调用栈的深度就是n。 @@ -214,7 +214,7 @@ int fibonacci(int i) { 最后对各种求斐波那契数列方法的性能做一下分析,如题: -![递归的空间复杂度分析](https://code-thinking-1253855093.file.myqcloud.com/pics/20210305095227356.png) +![递归的空间复杂度分析](https://file.kamacoder.com/pics/20210305095227356.png) 可以看出,求斐波那契数的时候,使用递归算法并不一定是在性能上是最优的,但递归确实简化的代码层面的复杂度。 diff --git "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" index 1ea1e65be8..befe549874 100644 --- "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" +++ "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" @@ -69,7 +69,7 @@ int function3(int x, int n) { 我们来分析一下,首先看递归了多少次呢,可以把递归抽象出一棵满二叉树。刚刚同学写的这个算法,可以用一棵满二叉树来表示(为了方便表示,选择n为偶数16),如图: -![递归算法的时间复杂度](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209193909426.png) +![递归算法的时间复杂度](https://file.kamacoder.com/pics/20201209193909426.png) 当前这棵二叉树就是求x的n次方,n为16的情况,n为16的时候,进行了多少次乘法运算呢? @@ -79,7 +79,7 @@ int function3(int x, int n) { 这么如果是求x的n次方,这个递归树有多少个节点呢,如下图所示:(m为深度,从0开始) -![递归求时间复杂度](https://code-thinking-1253855093.file.myqcloud.com/pics/20200728195531892.png) +![递归求时间复杂度](https://file.kamacoder.com/pics/20200728195531892.png) **时间复杂度忽略掉常数项`-1`之后,这个递归算法的时间复杂度依然是O(n)**。对,你没看错,依然是O(n)的时间复杂度! diff --git "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" index fd2d16f47a..a88919d4ca 100644 --- "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" +++ "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" @@ -35,11 +35,11 @@ 如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231030165201.png) +![](https://file.kamacoder.com/pics/20231030165201.png) 然后从后向前替换数字字符,也就是双指针法,过程如下:i指向新长度的末尾,j指向旧长度的末尾。 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231030173058.png) +![](https://file.kamacoder.com/pics/20231030173058.png) 有同学问了,为什么要从后向前填充,从前向后填充不行么? diff --git "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" index 6fe12e3d51..4c62312c8b 100644 --- "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" @@ -44,16 +44,16 @@ fgabcde 本题中,我们需要将字符串右移n位,字符串相当于分成了两个部分,如果n为2,符串相当于分成了两个部分,如图: (length为字符串长度) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106170143.png) +![](https://file.kamacoder.com/pics/20231106170143.png) 右移n位, 就是将第二段放在前面,第一段放在后面,先不考虑里面字符的顺序,是不是整体倒叙不就行了。如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106171557.png) +![](https://file.kamacoder.com/pics/20231106171557.png) 此时第一段和第二段的顺序是我们想要的,但里面的字符位置被我们倒叙,那么此时我们在把 第一段和第二段里面的字符再倒叙一把,这样字符顺序不就正确了。 如果: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106172058.png) +![](https://file.kamacoder.com/pics/20231106172058.png) 其实,思路就是 通过 整体倒叙,把两段子串顺序颠倒,两个段子串里的的字符在倒叙一把,**负负得正**,这样就不影响子串里面字符的顺序了。 @@ -84,7 +84,7 @@ int main() { 可以的,不过,要记得 控制好 局部反转的长度,如果先局部反转,那么先反转的子串长度就是 len - n,如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20231106172534.png) +![](https://file.kamacoder.com/pics/20231106172534.png) 代码如下: diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" index ea5082244c..3212ca5603 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -254,5 +254,5 @@ traversal(cur->left, tmp, result); * Github:[leetcode-master](https://github.com/youngyangyang04/leetcode-master) * 知乎:[代码随想录](https://www.zhihu.com/people/sun-xiu-yang-64) -![](https://code-thinking-1253855093.file.myqcloud.com/pics/2021013018121150.png) +![](https://file.kamacoder.com/pics/2021013018121150.png)
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" index 7e333c7672..d910ce2509 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -31,7 +31,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 在[回溯算法:求组合总和(二)](https://programmercarl.com/0039.组合总和.html)第一个树形结构没有画出startIndex的作用,**这里这里纠正一下,准确的树形结构如图所示:** -![39.组合总和](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170730367.png) +![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) ## 周二 @@ -45,7 +45,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 都知道组合问题可以抽象为树形结构,那么“使用过”在这个树形结构上是有两个维度的,一个维度是同一树枝上“使用过”,一个维度是同一树层上“使用过”。**没有理解这两个层面上的“使用过” 是造成大家没有彻底理解去重的根本原因**。 -![40.组合总和II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123202817973.png) +![40.组合总和II1](https://file.kamacoder.com/pics/20201123202817973.png) 我在图中将used的变化用橘黄色标注上,可以看出在candidates[i] == candidates[i - 1]相同的情况下: @@ -79,7 +79,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; **本题的树形结构中,和代码的逻辑有一个小出入,已经判断不是回文的子串就不会进入递归了,纠正如下:** -![131.分割回文串](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123203228309.png) +![131.分割回文串](https://file.kamacoder.com/pics/20201123203228309.png) ## 周四 @@ -90,7 +90,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形图如下: -![93.复原IP地址](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123203735933-20230310133532452.png) +![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933-20230310133532452.png) 在本文的树形结构图中,我已经把详细的分析思路都画了出来,相信大家看了之后一定会思路清晰不少! @@ -112,7 +112,7 @@ if (s.size() > 12) return result; // 剪枝 如图: -![78.子集](https://code-thinking-1253855093.file.myqcloud.com/pics/202011232041348.png) +![78.子集](https://file.kamacoder.com/pics/202011232041348.png) 认清这个本质之后,今天的题目就是一道模板题了。 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" index ec36d1213d..c2e122844d 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -11,14 +11,14 @@ 树形结构如下: -![90.子集II](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111217110449-20230310133150714.png) +![90.子集II](https://file.kamacoder.com/pics/2020111217110449-20230310133150714.png) ## 周二 在[回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)中,处处都能看到子集的身影,但处处是陷阱,值得好好琢磨琢磨! 树形结构如下: -![491. 递增子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112170832333-20230310133155209.png) +![491. 递增子序列1](https://file.kamacoder.com/pics/20201112170832333-20230310133155209.png) [回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)留言区大家有很多疑问,主要还是和[回溯算法:求子集问题(二)](https://programmercarl.com/0090.子集II.html)混合在了一起。 @@ -33,7 +33,7 @@ 可以看出元素1在[1,2]中已经使用过了,但是在[2,1]中还要在使用一次1,所以处理排列问题就不用使用startIndex了。 如图: -![46.全排列](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112170304979-20230310133201250.png) +![46.全排列](https://file.kamacoder.com/pics/20201112170304979-20230310133201250.png) **大家此时可以感受出排列问题的不同:** @@ -46,7 +46,7 @@ 树形结构如下: -![47.全排列II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112171930470-20230310133206398.png) +![47.全排列II1](https://file.kamacoder.com/pics/20201112171930470-20230310133206398.png) **这道题目神奇的地方就是used[i - 1] == false也可以,used[i - 1] == true也可以!** @@ -54,11 +54,11 @@ 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2.png](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112172230434-20230310133211392.png) +![47.全排列II2.png](https://file.kamacoder.com/pics/20201112172230434-20230310133211392.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112172327967-20230310133216389.png) +![47.全排列II3](https://file.kamacoder.com/pics/20201112172327967-20230310133216389.png) **可以清晰的看到使用(used[i - 1] == false),即树层去重,效率更高!** diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index 9209efda71..4ab1cddbff 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -15,7 +15,7 @@ 如图: -![122.买卖股票的最佳时机II](https://code-thinking-1253855093.file.myqcloud.com/pics/2020112917480858.png) +![122.买卖股票的最佳时机II](https://file.kamacoder.com/pics/2020112917480858.png) ## 周二 @@ -31,7 +31,7 @@ 如图: -![55.跳跃游戏](https://code-thinking-1253855093.file.myqcloud.com/pics/20201124154758229.png) +![55.跳跃游戏](https://file.kamacoder.com/pics/20201124154758229.png) ## 周三 @@ -44,7 +44,7 @@ 如图: -![45.跳跃游戏II](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232309103-20230310133110942.png) +![45.跳跃游戏II](https://file.kamacoder.com/pics/20201201232309103-20230310133110942.png) 注意:**图中的移动下标是到当前这步覆盖的最远距离(下标2的位置),此时没有到终点,只能增加第二步来扩大覆盖范围**。 @@ -55,10 +55,10 @@ 而版本二就比较统一的,超过范围,步数就加一,但在移动下标的范围了做了文章。 即如果覆盖最远距离下标是倒数第二点:直接加一就行,默认一定可以到终点。如图: -![45.跳跃游戏II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232445286-20230310133115650.png) +![45.跳跃游戏II2](https://file.kamacoder.com/pics/20201201232445286-20230310133115650.png) 如果覆盖最远距离下标不是倒数第二点,说明本次覆盖已经到终点了。如图: -![45.跳跃游戏II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201201232338693-20230310133120115.png) +![45.跳跃游戏II1](https://file.kamacoder.com/pics/20201201232338693-20230310133120115.png) 有的录友认为版本一好理解,有的录友认为版本二好理解,其实掌握一种就可以了,也不用非要比拼一下代码的简洁性,简洁程度都差不多了。 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" index 461219f2da..f449995b01 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -77,7 +77,7 @@ 文中从计算机硬件出发,分析计算机的计算性能,然后亲自做实验,整理出数据如下: -![程序超时1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201208231559175-20230310133304038.png) +![程序超时1](https://file.kamacoder.com/pics/20201208231559175-20230310133304038.png) **大家有一个数量级上的概念就可以了!** diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index 91f9656f48..19a95615a3 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -38,7 +38,7 @@ 如图: -![135.分发糖果](https://code-thinking-1253855093.file.myqcloud.com/pics/20201117114916878-20230310133332759.png) +![135.分发糖果](https://file.kamacoder.com/pics/20201117114916878-20230310133332759.png) 接着在贪心另一边,左孩子大于右孩子,左孩子的糖果就要比右孩子多。 @@ -50,7 +50,7 @@ 局部最优可以推出全局最优。 如图: -![135.分发糖果1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201117115658791-20230310133346127.png) +![135.分发糖果1](https://file.kamacoder.com/pics/20201117115658791-20230310133346127.png) ## 周三 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index b37bba80dc..a8ba7454eb 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -9,7 +9,7 @@ 如图: -![452.用最少数量的箭引爆气球](https://code-thinking-1253855093.file.myqcloud.com/pics/20201123101929791-20230310133845522.png) +![452.用最少数量的箭引爆气球](https://file.kamacoder.com/pics/20201123101929791-20230310133845522.png) 模拟射气球的过程,很多同学真的要去模拟了,实时把气球从数组中移走,这么写的话就复杂了,从前向后遍历重复的只要跳过就可以的。 @@ -21,7 +21,7 @@ 如图: -![435.无重叠区间](https://code-thinking-1253855093.file.myqcloud.com/pics/20201221201553618.png) +![435.无重叠区间](https://file.kamacoder.com/pics/20201221201553618.png) 细心的同学就发现了,此题和 [贪心算法:用最少数量的箭引爆气球](https://programmercarl.com/0452.用最少数量的箭引爆气球.html)非常像。 @@ -71,7 +71,7 @@ public: 如图: -![763.划分字母区间](https://code-thinking-1253855093.file.myqcloud.com/pics/20201222191924417-20230310133855435.png) +![763.划分字母区间](https://file.kamacoder.com/pics/20201222191924417-20230310133855435.png) ## 周四 @@ -86,7 +86,7 @@ public: 如图: -![56.合并区间](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223200632791-20230310133859587.png) +![56.合并区间](https://file.kamacoder.com/pics/20201223200632791-20230310133859587.png) ## 总结 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index ebc720caa0..1b6bd84bcc 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -31,7 +31,7 @@ for (int i = 1; i < m; i++) { } ``` -![62.不同路径1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201209113631392-20230310133703294.png) +![62.不同路径1](https://file.kamacoder.com/pics/20201209113631392-20230310133703294.png) ## 周二 @@ -45,7 +45,7 @@ dp[i][j]定义依然是:表示从(0 ,0)出发,到(i, j) 有dp[i][j]条 如图: -![63.不同路径II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114513928-20230310133707783.png) +![63.不同路径II](https://file.kamacoder.com/pics/20210104114513928-20230310133707783.png) 这里难住了不少同学,代码如下: @@ -70,11 +70,11 @@ for (int i = 1; i < m; i++) { 拿示例1来举例如题: -![63.不同路径II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114548983-20230310133711888.png) +![63.不同路径II1](https://file.kamacoder.com/pics/20210104114548983-20230310133711888.png) 对应的dp table 如图: -![63.不同路径II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104114610256-20230310133715981.png) +![63.不同路径II2](https://file.kamacoder.com/pics/20210104114610256-20230310133715981.png) ## 周三 @@ -111,7 +111,7 @@ for (int i = 3; i <= n ; i++) { 举例当n为10 的时候,dp数组里的数值,如下: -![343.整数拆分](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104173021581-20230310133720552.png) +![343.整数拆分](https://file.kamacoder.com/pics/20210104173021581-20230310133720552.png) @@ -143,7 +143,7 @@ dp数组如何初始化:只需要初始化dp[0]就可以了,推导的基础 n为5时候的dp数组状态如图: -![96.不同的二叉搜索树3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210107093253987-20230310133724531.png) +![96.不同的二叉搜索树3](https://file.kamacoder.com/pics/20210107093253987-20230310133724531.png) ## 总结 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 7bae5ca9ee..dc32891da8 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -17,7 +17,7 @@ 关于其他几种常用的背包,大家看这张图就了然于胸了: -![416.分割等和子集1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210117171307407-20230310133624872.png) +![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407-20230310133624872.png) 本文用动规五部曲详细讲解了01背包的二维dp数组的实现方法,大家其实可以发现最简单的是推导公式了,推导公式估计看一遍就记下来了,但难就难在确定初始化和遍历顺序上。 @@ -70,7 +70,7 @@ for(int i = 1; i < weight.size(); i++) { // 遍历物品 来看一下对应的dp数组的数值,如图: -![动态规划-背包问题4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210118163425129-20230310133630224.jpg) +![动态规划-背包问题4](https://file.kamacoder.com/pics/20210118163425129-20230310133630224.jpg) 最终结果就是dp[2][4]。 @@ -122,7 +122,7 @@ for(int i = 0; i < weight.size(); i++) { // 遍历物品 一维dp,分别用物品0,物品1,物品2 来遍历背包,最终得到结果如下: -![动态规划-背包问题9](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110103614769-20230310133634873.png) +![动态规划-背包问题9](https://file.kamacoder.com/pics/20210110103614769-20230310133634873.png) ## 周三 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index e785af1228..8598ec69f0 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -35,7 +35,7 @@ bagSize = (S + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![494.目标和](https://code-thinking-1253855093.file.myqcloud.com/pics/20210125120743274-20230310132918821.jpg) +![494.目标和](https://file.kamacoder.com/pics/20210125120743274-20230310132918821.jpg) ## 周二 @@ -73,7 +73,7 @@ dp[i][j] = max(dp[i][j], dp[i - zeroNum][j - oneNum] + 1); 最后dp数组的状态如下所示: -![474.一和零](https://code-thinking-1253855093.file.myqcloud.com/pics/20210120111201512-20230310132936011.jpg) +![474.一和零](https://file.kamacoder.com/pics/20210120111201512-20230310132936011.jpg) ## 周三 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 26d805bb3a..309f277f6a 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -30,7 +30,7 @@ dp[1] = max(nums[0], nums[1]); 以示例二,输入[2,7,9,3,1]为例。 -![198.打家劫舍](https://code-thinking-1253855093.file.myqcloud.com/pics/20210221170954115-20230310133425353.jpg) +![198.打家劫舍](https://file.kamacoder.com/pics/20210221170954115-20230310133425353.jpg) 红框dp[nums.size() - 1]为结果。 @@ -42,15 +42,15 @@ dp[1] = max(nums[0], nums[1]); * 情况一:考虑不包含首尾元素 -![213.打家劫舍II](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160748643.jpg) +![213.打家劫舍II](https://file.kamacoder.com/pics/20210129160748643.jpg) * 情况二:考虑包含首元素,不包含尾元素 -![213.打家劫舍II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160821374.jpg) +![213.打家劫舍II1](https://file.kamacoder.com/pics/20210129160821374.jpg) * 情况三:考虑包含尾元素,不包含首元素 -![213.打家劫舍II2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129160842491.jpg) +![213.打家劫舍II2](https://file.kamacoder.com/pics/20210129160842491.jpg) 需要注意的是,**“考虑” 不等于 “偷”**,例如情况三,虽然是考虑包含尾元素,但不一定要选尾部元素!对于情况三,取nums[1] 和 nums[3]就是最大的。 @@ -178,7 +178,7 @@ return {val2, val1}; 以示例1为例,dp数组状态如下:(**注意用后序遍历的方式推导**) -![337.打家劫舍III](https://code-thinking-1253855093.file.myqcloud.com/pics/20210129181331613.jpg) +![337.打家劫舍III](https://file.kamacoder.com/pics/20210129181331613.jpg) **最后头结点就是 取下标0 和 下标1的最大值就是偷得的最大金钱**。 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index ec442a3979..5d84fb1915 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -77,7 +77,7 @@ dp[0][4] = 0; 以输入[1,2,3,4,5]为例 -![123.买卖股票的最佳时机III](https://code-thinking-1253855093.file.myqcloud.com/pics/20201228181724295.png) +![123.买卖股票的最佳时机III](https://file.kamacoder.com/pics/20201228181724295.png) 可以看到红色框为最后两次卖出的状态。 @@ -144,7 +144,7 @@ for (int j = 1; j < 2 * k; j += 2) { 以输入[1,2,3,4,5],k=2为例。 -![188.买卖股票的最佳时机IV](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229100358221-20230310133805763.png) +![188.买卖股票的最佳时机IV](https://file.kamacoder.com/pics/20201229100358221-20230310133805763.png) 最后一次卖出,一定是利润最大的,dp[prices.size() - 1][2 * k]即红色部分就是最后求解。 @@ -197,7 +197,7 @@ vector> dp(n, vector(3, 0)); 以 [1,2,3,0,2] 为例,dp数组如下: -![309.最佳买卖股票时机含冷冻期](https://code-thinking-1253855093.file.myqcloud.com/pics/20201229163725348.png) +![309.最佳买卖股票时机含冷冻期](https://file.kamacoder.com/pics/20201229163725348.png) 最后两个状态 不持有股票(能购买) 和 不持有股票(冷冻期)都有可能最后结果,取最大的。 diff --git "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" index b7d10671e1..92b590bc89 100644 --- "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -18,7 +18,7 @@ 哈希表中关键码就是数组的索引下标,然后通过下标直接访问数组中的元素,如下图所示: -![哈希表1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104234805168.png) +![哈希表1](https://file.kamacoder.com/pics/20210104234805168.png) 那么哈希表能解决什么问题呢,**一般哈希表都是用来快速判断一个元素是否出现集合里。** @@ -36,7 +36,7 @@ 哈希函数如下图所示,通过hashCode把名字转化为数值,一般hashcode是通过特定编码方式,可以将其他数据格式转化为不同的数值,这样就把学生名字映射为哈希表上的索引数字了。 -![哈希表2](https://code-thinking-1253855093.file.myqcloud.com/pics/2021010423484818.png) +![哈希表2](https://file.kamacoder.com/pics/2021010423484818.png) 如果hashCode得到的数值大于 哈希表的大小了,也就是大于tableSize了,怎么办呢? @@ -52,7 +52,7 @@ 如图所示,小李和小王都映射到了索引下标 1 的位置,**这一现象叫做哈希碰撞**。 -![哈希表3](https://code-thinking-1253855093.file.myqcloud.com/pics/2021010423494884.png) +![哈希表3](https://file.kamacoder.com/pics/2021010423494884.png) 一般哈希碰撞有两种解决方法, 拉链法和线性探测法。 @@ -60,7 +60,7 @@ 刚刚小李和小王在索引1的位置发生了冲突,发生冲突的元素都被存储在链表中。 这样我们就可以通过索引找到小李和小王了 -![哈希表4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235015226.png) +![哈希表4](https://file.kamacoder.com/pics/20210104235015226.png) (数据规模是dataSize, 哈希表的大小为tableSize) @@ -72,7 +72,7 @@ 例如冲突的位置,放了小李,那么就向下找一个空位放置小王的信息。所以要求tableSize一定要大于dataSize ,要不然哈希表上就没有空置的位置来存放 冲突的数据了。如图所示: -![哈希表5](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235109950.png) +![哈希表5](https://file.kamacoder.com/pics/20210104235109950.png) 其实关于哈希碰撞还有非常多的细节,感兴趣的同学可以再好好研究一下,这里我就不再赘述了。 @@ -117,7 +117,7 @@ std::unordered_map 底层实现为哈希表,std::map 和std::multimap 的底 实际上功能都是一样一样的, 但是unordered_set在C++11的时候被引入标准库了,而hash_set并没有,所以建议还是使用unordered_set比较好,这就好比一个是官方认证的,hash_set,hash_map 是C++11标准之前民间高手自发造的轮子。 -![哈希表6](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235134572.png) +![哈希表6](https://file.kamacoder.com/pics/20210104235134572.png) ## 总结 diff --git "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" index b8d96193ee..8fd69d518e 100644 --- "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" +++ "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" @@ -63,7 +63,7 @@ void backtracking(参数) { 本题我把回溯问题抽象为树形结构,如题: -![77.组合1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118152928844.png) +![77.组合1](https://file.kamacoder.com/pics/20201118152928844.png) 可以直观的看出其搜索的过程:**for循环横向遍历,递归纵向遍历,回溯不断调整结果集**,这个理念贯穿整个回溯法系列,也是我做了很多回溯的题目,不断摸索其规律才总结出来的。 @@ -73,7 +73,7 @@ void backtracking(参数) { 优化回溯算法只有剪枝一种方法,在[回溯算法:组合问题再剪剪枝](https://programmercarl.com/0077.组合优化.html)中把回溯法代码做了剪枝优化,树形结构如图: -![77.组合4](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118153133458.png) +![77.组合4](https://file.kamacoder.com/pics/20201118153133458.png) 大家可以一目了然剪的究竟是哪里。 @@ -89,11 +89,11 @@ void backtracking(参数) { 在[回溯算法:求组合总和!](https://programmercarl.com/0216.组合总和III.html)中,相当于 [回溯算法:求组合问题!](https://programmercarl.com/0077.组合.html)加了一个元素总和的限制。 树形结构如图: -![216.组合总和III](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118201921245.png) +![216.组合总和III](https://file.kamacoder.com/pics/20201118201921245.png) 整体思路还是一样的,本题的剪枝会好想一些,即:**已选元素总和如果已经大于n(题中要求的和)了,那么往后遍历就没有意义了,直接剪掉**,如图: -![216.组合总和III1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118202038240.png) +![216.组合总和III1](https://file.kamacoder.com/pics/20201118202038240.png) 在本题中,依然还可以有一个剪枝,就是[回溯算法:组合问题再剪剪枝](https://programmercarl.com/0077.组合优化.html)中提到的,对for循环选择的起始范围的剪枝。 @@ -114,7 +114,7 @@ void backtracking(参数) { **注意以上我只是说求组合的情况,如果是排列问题,又是另一套分析的套路**。 树形结构如下: -![39.组合总和](https://code-thinking-1253855093.file.myqcloud.com/pics/20201223170730367.png) +![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) 最后还给出了本题的剪枝优化,如下: @@ -125,7 +125,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 优化后树形结构如下: -![39.组合总和1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118202115929.png) +![39.组合总和1](https://file.kamacoder.com/pics/20201118202115929.png) #### 组合总和(三) @@ -140,7 +140,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 都知道组合问题可以抽象为树形结构,那么“使用过”在这个树形结构上是有两个维度的,一个维度是同一树枝上“使用过”,一个维度是同一树层上“使用过”。**没有理解这两个层面上的“使用过” 是造成大家没有彻底理解去重的根本原因**。 -![40.组合总和II1](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111820220675.png) +![40.组合总和II1](https://file.kamacoder.com/pics/2020111820220675.png) 我在图中将used的变化用橘黄色标注上,**可以看出在candidates[i] == candidates[i - 1]相同的情况下:** @@ -161,7 +161,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形结构如下: -![17. 电话号码的字母组合](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118202335724.png) +![17. 电话号码的字母组合](https://file.kamacoder.com/pics/20201118202335724.png) 如果大家在现场面试的时候,一定要注意各种输入异常的情况,例如本题输入1 * #按键。 @@ -189,7 +189,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形结构如下: -![131.分割回文串](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118202448642.png) +![131.分割回文串](https://file.kamacoder.com/pics/20201118202448642.png) ## 子集问题 @@ -200,7 +200,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 如图: -![78.子集](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118202544339.png) +![78.子集](https://file.kamacoder.com/pics/20201118202544339.png) 认清这个本质之后,今天的题目就是一道模板题了。 @@ -227,14 +227,14 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树形结构如下: -![90.子集II](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111217110449.png) +![90.子集II](https://file.kamacoder.com/pics/2020111217110449.png) ### 递增子序列 在[回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)中,处处都能看到子集的身影,但处处是陷阱,值得好好琢磨琢磨! 树形结构如下: -![491. 递增子序列1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112170832333.png) +![491. 递增子序列1](https://file.kamacoder.com/pics/20201112170832333.png) 很多同学都会把这道题目和[回溯算法:求子集问题(二)](https://programmercarl.com/0090.子集II.html)混在一起。 @@ -243,7 +243,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 我用没有排序的集合{2,1,2,2}来举个例子画一个图,如下: -![90.子集II2](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111316440479.png) +![90.子集II2](https://file.kamacoder.com/pics/2020111316440479.png) **相信这个图胜过千言万语的解释了**。 @@ -259,7 +259,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 如图: -![46.全排列](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112170304979.png) +![46.全排列](https://file.kamacoder.com/pics/20201112170304979.png) **大家此时可以感受出排列问题的不同:** @@ -272,7 +272,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树形结构如下: -![47.全排列II1](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112171930470.png) +![47.全排列II1](https://file.kamacoder.com/pics/20201112171930470.png) **这道题目神奇的地方就是used[i - 1] == false也可以,used[i - 1] == true也可以!** @@ -280,11 +280,11 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2.png](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112172230434.png) +![47.全排列II2.png](https://file.kamacoder.com/pics/20201112172230434.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201112172327967.png) +![47.全排列II3](https://file.kamacoder.com/pics/20201112172327967.png) **可以清晰的看到使用(used[i - 1] == false),即树层去重,效率更高!** @@ -318,7 +318,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 以输入:[["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]为例,抽象为树形结构如下: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111518065555.png) +![](https://file.kamacoder.com/pics/2020111518065555.png) 本题可以算是一道hard的题目了,关于本题的难点我在文中已经详细列出。 @@ -335,7 +335,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 下面我用一个3 * 3 的棋盘,将搜索过程抽象为一棵树,如图: -![51.N皇后](https://code-thinking-1253855093.file.myqcloud.com/pics/20201118225433127.png) +![51.N皇后](https://file.kamacoder.com/pics/20201118225433127.png) 从图中,可以看出,二维矩阵中矩阵的高就是这棵树的高度,矩阵的宽就是树形结构中每一个节点的宽度。 @@ -363,7 +363,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 因为这个树形结构太大了,我抽取一部分,如图所示: -![37.解数独](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111720451790.png) +![37.解数独](https://file.kamacoder.com/pics/2020111720451790.png) 解数独可以说是非常难的题目了,如果还一直停留在一维递归的逻辑中,这道题目可以让大家瞬间崩溃。 @@ -438,7 +438,7 @@ N皇后问题分析: 回溯专题汇聚为一张图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211030124742.png) +![](https://file.kamacoder.com/pics/20211030124742.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[莫非毛](https://wx.zsxq.com/dweb2/index/footprint/828844212542),所画,总结的非常好,分享给大家。 diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" index f1e1570a61..5c20f562b6 100644 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" @@ -15,7 +15,7 @@ 我用没有排序的集合{2,1,2,2}来举例子画一个图,如图: -![90.子集II2](https://code-thinking-1253855093.file.myqcloud.com/pics/2020111316440479-20230310121930316.png) +![90.子集II2](https://file.kamacoder.com/pics/2020111316440479-20230310121930316.png) 图中,大家就很明显的看到,子集重复了。 @@ -95,7 +95,7 @@ private: 如图: -![90.子集II1](https://code-thinking-1253855093.file.myqcloud.com/pics/202011131625054.png) +![90.子集II1](https://file.kamacoder.com/pics/202011131625054.png) 可以看出一旦把unordered_set uset放在类成员位置,它控制的就是整棵树,包括树枝。 diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" index 474fb8f749..d31e9651b8 100644 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -6,7 +6,7 @@ ## 题目分类 -回溯算法大纲 +回溯算法大纲 ## 算法公开课 @@ -114,7 +114,7 @@ if (终止条件) { 如图: -![回溯算法理论基础](https://code-thinking-1253855093.file.myqcloud.com/pics/20210130173631174.png) +![回溯算法理论基础](https://file.kamacoder.com/pics/20210130173631174.png) 注意图中,我特意举例集合大小和孩子的数量是相等的! diff --git "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" index e45165a625..e29a7bd379 100644 --- "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" @@ -125,7 +125,7 @@ ## 总结 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/数组总结.png) +![](https://file.kamacoder.com/pics/数组总结.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画,总结的非常好,分享给大家。 diff --git "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" index c1ac287d0f..4000208a9b 100644 --- "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -40,7 +40,7 @@ 那么二维数组直接上图,大家应该就知道怎么回事了 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240606105522.png) +![](https://file.kamacoder.com/pics/20240606105522.png) **那么二维数组在内存的空间地址是连续的么?** @@ -80,7 +80,7 @@ int main() { 如图: -![数组内存](https://code-thinking-1253855093.file.myqcloud.com/pics/20210310150641186.png) +![数组内存](https://file.kamacoder.com/pics/20210310150641186.png) **所以可以看出在C++中二维数组在地址空间上是连续的**。 @@ -111,7 +111,7 @@ public static void test_arr() { 所以Java的二维数组可能是如下排列的方式: -![算法通关数组3](https://code-thinking-1253855093.file.myqcloud.com/pics/20201214111631844.png) +![算法通关数组3](https://file.kamacoder.com/pics/20201214111631844.png) 这里面试中数组相关的理论知识就介绍完了。 diff --git "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" index bff0ec634b..912bfe1d70 100644 --- "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -11,7 +11,7 @@ 如图所示: -![栈与队列理论1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235346563.png) +![栈与队列理论1](https://file.kamacoder.com/pics/20210104235346563.png) 那么我这里再列出四个关于栈的问题,大家可以思考一下。以下是以C++为例,使用其他编程语言的同学也对应思考一下,自己使用的编程语言里栈和队列是什么样的。 @@ -46,7 +46,7 @@ C++标准库是有多个版本的,要知道我们使用的STL是哪个版本 来说一说栈,栈先进后出,如图所示: -![栈与队列理论2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235434905.png) +![栈与队列理论2](https://file.kamacoder.com/pics/20210104235434905.png) 栈提供push 和 pop 等等接口,所有元素必须符合先进后出规则,所以栈不提供走访功能,也不提供迭代器(iterator)。 不像是set 或者map 提供迭代器iterator来遍历所有元素。 @@ -59,7 +59,7 @@ C++标准库是有多个版本的,要知道我们使用的STL是哪个版本 从下图中可以看出,栈的内部结构,栈的底层实现可以是vector,deque,list 都是可以的, 主要就是数组和链表的底层实现。 -![栈与队列理论3](https://code-thinking-1253855093.file.myqcloud.com/pics/20210104235459376.png) +![栈与队列理论3](https://file.kamacoder.com/pics/20210104235459376.png) **我们常用的SGI STL,如果没有指定底层实现的话,默认是以deque为缺省情况下栈的底层结构。** diff --git "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" index a2350835d6..162ee273e3 100644 --- "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" +++ "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" @@ -35,7 +35,7 @@ public: ``` 耗时如下: -![vectorinsert](https://code-thinking-1253855093.file.myqcloud.com/pics/20201218203611181.png) +![vectorinsert](https://file.kamacoder.com/pics/20201218203611181.png) 其直观上来看数组的insert操作是O(n)的,整体代码的时间复杂度是O(n^2)。 @@ -68,7 +68,7 @@ public: 耗时如下: -![使用链表](https://code-thinking-1253855093.file.myqcloud.com/pics/20201218200756257.png) +![使用链表](https://file.kamacoder.com/pics/20201218200756257.png) 大家都知道对于普通数组,一旦定义了大小就不能改变,例如int a[10];,这个数组a至多只能放10个元素,改不了的。 @@ -95,7 +95,7 @@ for (int i = 0; i < vec.size(); i++) { 就是重新申请一个二倍于原数组大小的数组,然后把数据都拷贝过去,并释放原数组内存。(对,就是这么原始粗暴的方法!) 举一个例子,如图: -![vector原理](https://code-thinking-1253855093.file.myqcloud.com/pics/20201218185902217.png) +![vector原理](https://file.kamacoder.com/pics/20201218185902217.png) 原vector中的size和capicity相同都是3,初始化为1 2 3,此时要push_back一个元素4。 @@ -138,7 +138,7 @@ public: 耗时如下: -![vector手动模拟insert](https://code-thinking-1253855093.file.myqcloud.com/pics/20201218200626718.png) +![vector手动模拟insert](https://file.kamacoder.com/pics/20201218200626718.png) 这份代码就是不让vector动态扩容,全程我们自己模拟insert的操作,大家也可以直观的看出是一个O(n^2)的方法了。 diff --git "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" index 3c587b6d2e..9ce3fdda98 100644 --- "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" @@ -11,7 +11,7 @@ 关于这几种常见的背包,其关系如下: -![416.分割等和子集1](https://code-thinking-1253855093.file.myqcloud.com/pics/20230310000726.png) +![416.分割等和子集1](https://file.kamacoder.com/pics/20230310000726.png) 通过这个图,可以很清晰分清这几种常见背包之间的关系。 @@ -93,7 +93,7 @@ 背包问题总结: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/背包问题1.jpeg) +![](https://file.kamacoder.com/pics/背包问题1.jpeg) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画结的非常好,分享给大家。 diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" index c2598ec99a..79751c89e9 100644 --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" @@ -21,7 +21,7 @@ 如果这几种背包,分不清,我这里画了一个图,如下: -![416.分割等和子集1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210117171307407.png) +![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407.png) 除此以外其他类型的背包,面试几乎不会问,都是竞赛级别的了,leetcode上连多重背包的题目都没有,所以题库也告诉我们,01背包和完全背包就够用了。 @@ -77,7 +77,7 @@ leetcode上没有纯01背包的问题,都是01背包应用方面的题目, 如图,二维数组为 dp[i][j]。 -![动态规划-背包问题1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110103003361.png) +![动态规划-背包问题1](https://file.kamacoder.com/pics/20210110103003361.png) 那么这里 i 、j、dp[i][j] 分别表示什么呢? @@ -91,7 +91,7 @@ i 来表示物品、j表示背包容量。 我们先看把物品0 放入背包的情况: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240730113455.png) +![](https://file.kamacoder.com/pics/20240730113455.png) 背包容量为0,放不下物品0,此时背包里的价值为0。 @@ -103,7 +103,7 @@ i 来表示物品、j表示背包容量。 再看把物品1 放入背包: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240730114228.png) +![](https://file.kamacoder.com/pics/20240730114228.png) 背包容量为 0,放不下物品0 或者物品1,此时背包里的价值为0。 @@ -150,7 +150,7 @@ i 来表示物品、j表示背包容量。 推导方向如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240730174246.png) +![](https://file.kamacoder.com/pics/20240730174246.png) 如果放物品1, **那么背包要先留出物品1的容量**,目前容量是4,物品1 的容量(就是物品1的重量)为3,此时背包剩下容量为1。 @@ -158,7 +158,7 @@ i 来表示物品、j表示背包容量。 所以 放物品1 的情况 = dp[0][1] + 物品1 的价值,推导方向如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20240730174436.png) +![](https://file.kamacoder.com/pics/20240730174436.png) 两种情况,分别是放物品1 和 不放物品1,我们要取最大值(毕竟求的是最大价值) @@ -178,7 +178,7 @@ i 来表示物品、j表示背包容量。 首先从dp[i][j]的定义出发,如果背包容量j为0的话,即dp[i][0],无论是选取哪些物品,背包价值总和一定为0。如图: -![动态规划-背包问题2](https://code-thinking-1253855093.file.myqcloud.com/pics/2021011010304192.png) +![动态规划-背包问题2](https://file.kamacoder.com/pics/2021011010304192.png) 在看其他情况。 @@ -205,7 +205,7 @@ for (int j = weight[0]; j <= bagweight; j++) { 此时dp数组初始化情况如图所示: -![动态规划-背包问题7](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110103109140.png) +![动态规划-背包问题7](https://file.kamacoder.com/pics/20210110103109140.png) dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化多少呢? @@ -217,7 +217,7 @@ dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化 如图: -![动态规划-背包问题10](https://code-thinking-1253855093.file.myqcloud.com/pics/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92-%E8%83%8C%E5%8C%85%E9%97%AE%E9%A2%9810.jpg) +![动态规划-背包问题10](https://file.kamacoder.com/pics/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92-%E8%83%8C%E5%8C%85%E9%97%AE%E9%A2%9810.jpg) 最后初始化代码如下: @@ -236,7 +236,7 @@ for (int j = weight[0]; j <= bagweight; j++) { 在如下图中,可以看出,有两个遍历的维度:物品与背包重量 -![动态规划-背包问题3](https://code-thinking-1253855093.file.myqcloud.com/pics/2021011010314055.png) +![动态规划-背包问题3](https://file.kamacoder.com/pics/2021011010314055.png) 那么问题来了,**先遍历 物品还是先遍历背包重量呢?** @@ -277,11 +277,11 @@ for(int j = 0; j <= bagweight; j++) { // 遍历背包容量 dp[i-1][j]和dp[i - 1][j - weight[i]] 都在dp[i][j]的左上角方向(包括正上方向),那么先遍历物品,再遍历背包的过程如图所示: -![动态规划-背包问题5](https://code-thinking-1253855093.file.myqcloud.com/pics/202101101032124.png) +![动态规划-背包问题5](https://file.kamacoder.com/pics/202101101032124.png) 再来看看先遍历背包,再遍历物品呢,如图: -![动态规划-背包问题6](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110103244701.png) +![动态规划-背包问题6](https://file.kamacoder.com/pics/20210110103244701.png) **大家可以看出,虽然两个for循环遍历的次序不同,但是dp[i][j]所需要的数据就是左上角,根本不影响dp[i][j]公式的推导!** @@ -293,7 +293,7 @@ dp[i-1][j]和dp[i - 1][j - weight[i]] 都在dp[i][j]的左上角方向(包括 来看一下对应的dp数组的数值,如图: -![动态规划-背包问题4](https://code-thinking-1253855093.file.myqcloud.com/pics/20210118163425129.jpg) +![动态规划-背包问题4](https://file.kamacoder.com/pics/20210118163425129.jpg) 最终结果就是dp[2][4]。 diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" index 6caa4f6327..b6a68960a9 100644 --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" @@ -163,7 +163,7 @@ dp[1] = dp[1 - weight[0]] + value[0] = 15 一维dp,分别用物品0,物品1,物品2 来遍历背包,最终得到结果如下: -![动态规划-背包问题9](https://code-thinking-1253855093.file.myqcloud.com/pics/20210110103614769.png) +![动态规划-背包问题9](https://file.kamacoder.com/pics/20210110103614769.png) 本题力扣上没有原题,大家可以去[卡码网第46题](https://kamacoder.com/problempage.php?pid=1046)去练习,题意是一样的,代码如下: diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" index 5a23b67c73..be7a5d54f9 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" @@ -54,11 +54,11 @@ for (int i = 1; i < n; i++) { // 遍历物品 遍历物品在外层循环,遍历背包容量在内层循环,状态如图: -![动态规划-完全背包1](https://code-thinking-1253855093.file.myqcloud.com/pics/20210126104529605.jpg) +![动态规划-完全背包1](https://file.kamacoder.com/pics/20210126104529605.jpg) 遍历背包容量在外层循环,遍历物品在内层循环,状态如图: -![动态规划-完全背包2](https://code-thinking-1253855093.file.myqcloud.com/pics/20210729234011.png) +![动态规划-完全背包2](https://file.kamacoder.com/pics/20210729234011.png) 看了这两个图,大家就会理解,完全背包中,两个for循环的先后循序,都不影响计算dp[j]所需要的值(这个值就是下标j之前所对应的dp[j])。 diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" index d76ff196b1..cb8db1e0e3 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" @@ -66,7 +66,7 @@ 推导方向如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20241126112952.png) +![](https://file.kamacoder.com/pics/20241126112952.png) 如果放物品1, **那么背包要先留出物品1的容量**,目前容量是4,物品1 的容量(就是物品1的重量)为3,此时背包剩下容量为1。 @@ -78,7 +78,7 @@ 所以 放物品1 的情况 = dp[1][1] + 物品1 的价值,推导方向如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20241126113104.png) +![](https://file.kamacoder.com/pics/20241126113104.png) (**注意上图和 [01背包理论基础(二维数组)](https://programmercarl.com/背包理论基础01背包-1.html) 中的区别**,对于理解完全背包很重要) @@ -103,7 +103,7 @@ 首先从dp[i][j]的定义出发,如果背包容量j为0的话,即dp[i][0],无论是选取哪些物品,背包价值总和一定为0。如图: -![动态规划-背包问题2](https://code-thinking-1253855093.file.myqcloud.com/pics/2021011010304192.png) +![动态规划-背包问题2](https://file.kamacoder.com/pics/2021011010304192.png) 在看其他情况。 @@ -132,7 +132,7 @@ for (int j = weight[0]; j <= bagWeight; j++) 此时dp数组初始化情况如图所示: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20241114161608.png) +![](https://file.kamacoder.com/pics/20241114161608.png) dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化多少呢? @@ -185,7 +185,7 @@ for(int j = 0; j <= bagWeight; j++) { // 遍历背包容量 以本篇举例数据为例,填满了dp二维数组如图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20241126113752.png) +![](https://file.kamacoder.com/pics/20241126113752.png) 因为 物品0 的性价比是最高的,而且 在完全背包中,每一类物品都有无限个,所以有无限个物品0,既然物品0 性价比最高,当然是优先放物品0。 diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" index 7d4c57e877..4c67fb401a 100644 --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" @@ -128,7 +128,7 @@ Carl个人认为:如果找出局部最优并可以推出全局最优,就是 贪心专题汇聚为一张图: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/贪心总结water.png) +![](https://file.kamacoder.com/pics/贪心总结water.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412)所画,总结的非常好,分享给大家。 diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" index 14f397296f..2d0af8791a 100644 --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -7,7 +7,7 @@ 题目分类大纲如下: -贪心算法大纲 +贪心算法大纲 ## 算法公开课 diff --git "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" index e29ba268a3..99bb2abcd0 100644 --- "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" @@ -75,7 +75,7 @@ ## 总结 -![](https://code-thinking-1253855093.file.myqcloud.com/pics/链表总结.png) +![](https://file.kamacoder.com/pics/链表总结.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画,总结的非常好,分享给大家。 diff --git "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" index 3637d05f5a..5305c9a9dc 100644 --- "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -12,7 +12,7 @@ 链表的入口节点称为链表的头结点也就是head。 如图所示: -![链表1](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806194529815.png) +![链表1](https://file.kamacoder.com/pics/20200806194529815.png) ## 链表的类型 @@ -31,7 +31,7 @@ 双链表 既可以向前查询也可以向后查询。 如图所示: -![链表2](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806194559317.png) +![链表2](https://file.kamacoder.com/pics/20200806194559317.png) ### 循环链表 @@ -39,7 +39,7 @@ 循环链表可以用来解决约瑟夫环问题。 -![链表4](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806194629603.png) +![链表4](https://file.kamacoder.com/pics/20200806194629603.png) ## 链表的存储方式 @@ -54,7 +54,7 @@ 如图所示: -![链表3](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806194613920.png) +![链表3](https://file.kamacoder.com/pics/20200806194613920.png) 这个链表起始节点为2, 终止节点为7, 各个节点分布在内存的不同地址空间上,通过指针串联在一起。 @@ -104,7 +104,7 @@ head->val = 5; 删除D节点,如图所示: -![链表-删除节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806195114541-20230310121459257.png) +![链表-删除节点](https://file.kamacoder.com/pics/20200806195114541-20230310121459257.png) 只要将C节点的next指针 指向E节点就可以了。 @@ -118,7 +118,7 @@ head->val = 5; 如图所示: -![链表-添加节点](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806195134331-20230310121503147.png) +![链表-添加节点](https://file.kamacoder.com/pics/20200806195134331-20230310121503147.png) 可以看出链表的增添和删除都是O(1)操作,也不会影响到其他节点。 @@ -128,7 +128,7 @@ head->val = 5; 再把链表的特性和数组的特性进行一个对比,如图所示: -![链表-链表与数据性能对比](https://code-thinking-1253855093.file.myqcloud.com/pics/20200806195200276.png) +![链表-链表与数据性能对比](https://file.kamacoder.com/pics/20200806195200276.png) 数组在定义的时候,长度就是固定的,如果想改动数组的长度,就需要重新定义一个新的数组。 diff --git "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" index f8d9039a48..0207b71eac 100644 --- "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" +++ "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" @@ -13,7 +13,7 @@ 图示两个链表在节点 c1 开始相交: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211219221657.png) +![](https://file.kamacoder.com/pics/20211219221657.png) 题目数据 保证 整个链式结构中不存在环。 @@ -21,15 +21,15 @@ 示例 1: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211219221723.png) +![](https://file.kamacoder.com/pics/20211219221723.png) 示例 2: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211219221749.png) +![](https://file.kamacoder.com/pics/20211219221749.png) 示例 3: -![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211219221812.png)![](https://code-thinking-1253855093.file.myqcloud.com/pics/20211219221812.png) +![](https://file.kamacoder.com/pics/20211219221812.png) From ce6e658d14c5644c907fab6dfac58d88353a2ec3 Mon Sep 17 00:00:00 2001 From: kama Date: Mon, 19 May 2025 17:11:04 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +- ...44\346\225\260\344\271\213\345\222\214.md" | 4 +- ...36\346\226\207\345\255\220\344\270\262.md" | 4 +- ...11\346\225\260\344\271\213\345\222\214.md" | 2 +- ...27\346\257\215\347\273\204\345\220\210.md" | 4 +- ...33\346\225\260\344\271\213\345\222\214.md" | 0 ...4N\344\270\252\350\212\202\347\202\271.md" | 10 +- ...10\347\232\204\346\213\254\345\217\267.md" | 8 +- ...55\347\232\204\350\212\202\347\202\271.md" | 10 +- ...73\351\231\244\345\205\203\347\264\240.md" | 4 +- .../0028.\345\256\236\347\216\260strStr.md" | 20 +- ...00\344\270\252\346\216\222\345\210\227.md" | 2 +- ...00\344\270\252\344\275\215\347\275\256.md" | 0 ...22\345\205\245\344\275\215\347\275\256.md" | 10 +- ...7.\350\247\243\346\225\260\347\213\254.md" | 8 +- ...04\345\220\210\346\200\273\345\222\214.md" | 8 +- ...\345\220\210\346\200\273\345\222\214II.md" | 6 +- ...2.\346\216\245\351\233\250\346\260\264.md" | 14 +- ...\350\267\203\346\270\270\346\210\217II.md" | 6 +- ...6.\345\205\250\346\216\222\345\210\227.md" | 6 +- ...\345\205\250\346\216\222\345\210\227II.md" | 6 +- "problems/0051.N\347\232\207\345\220\216.md" | 6 +- .../0052.N\347\232\207\345\220\216II.md" | 2 +- ...47\345\255\220\345\272\217\345\222\214.md" | 2 +- ...01\350\247\204\345\210\222\357\274\211.md" | 2 +- ...72\346\227\213\347\237\251\351\230\265.md" | 2 +- ...63\350\267\203\346\270\270\346\210\217.md" | 2 +- ...10\345\271\266\345\214\272\351\227\264.md" | 2 +- ...\346\227\213\347\237\251\351\230\265II.md" | 2 +- ...15\345\220\214\350\267\257\345\276\204.md" | 10 +- ...\345\220\214\350\267\257\345\276\204II.md" | 12 +- ...0.\347\210\254\346\245\274\346\242\257.md" | 2 +- ...14\345\214\205\347\211\210\346\234\254.md" | 0 ...26\350\276\221\350\267\235\347\246\273.md" | 4 +- "problems/0077.\347\273\204\345\220\210.md" | 10 +- ...04\345\220\210\344\274\230\345\214\226.md" | 2 +- "problems/0078.\345\255\220\351\233\206.md" | 4 +- ...47\347\232\204\347\237\251\345\275\242.md" | 10 +- "problems/0090.\345\255\220\351\233\206II.md" | 2 +- ...\345\216\237IP\345\234\260\345\235\200.md" | 4 +- ...11\346\220\234\347\264\242\346\240\221.md" | 10 +- ...11\346\220\234\347\264\242\346\240\221.md" | 4 +- ...70\345\220\214\347\232\204\346\240\221.md" | 4 +- ...60\344\272\214\345\217\211\346\240\221.md" | 6 +- ...02\345\272\217\351\201\215\345\216\206.md" | 22 +- ...00\345\244\247\346\267\261\345\272\246.md" | 6 +- ...40\344\272\214\345\217\211\346\240\221.md" | 8 +- ...11\346\220\234\347\264\242\346\240\221.md" | 6 +- ...41\344\272\214\345\217\211\346\240\221.md" | 6 +- ...00\345\260\217\346\267\261\345\272\246.md" | 6 +- ...57\345\276\204\346\200\273\345\222\214.md" | 8 +- ...04\345\255\220\345\272\217\345\210\227.md" | 8 +- ...02\347\202\271\346\214\207\351\222\210.md" | 4 +- ...00\344\275\263\346\227\266\346\234\272.md" | 2 +- ...\344\275\263\346\227\266\346\234\272II.md" | 2 +- ...01\350\247\204\345\210\222\357\274\211.md" | 0 ...344\275\263\346\227\266\346\234\272III.md" | 2 +- ...25\350\257\215\346\216\245\351\276\231.md" | 2 +- ...60\345\255\227\344\271\213\345\222\214.md" | 2 +- ...25\347\232\204\345\214\272\345\237\237.md" | 6 +- ...62\345\233\236\346\226\207\344\270\262.md" | 4 +- ...\345\233\236\346\226\207\344\270\262II.md" | 2 +- ...4.\345\212\240\346\262\271\347\253\231.md" | 4 +- ...06\345\217\221\347\263\226\346\236\234.md" | 6 +- ...25\350\257\215\346\213\206\345\210\206.md" | 4 +- ...57\345\275\242\351\223\276\350\241\250.md" | 6 +- ...\345\275\242\351\223\276\350\241\250II.md" | 16 +- ...15\346\216\222\351\223\276\350\241\250.md" | 4 +- ...76\345\274\217\346\261\202\345\200\274.md" | 2 +- ...14\347\232\204\345\215\225\350\257\215.md" | 0 ...70\344\272\244\351\223\276\350\241\250.md" | 0 ...\344\275\263\346\227\266\346\234\272IV.md" | 2 +- ...13\350\275\254\346\225\260\347\273\204.md" | 0 ...23\345\256\266\345\212\253\350\210\215.md" | 2 +- ...7.\345\271\277\346\220\234\347\211\210.md" | 6 +- ...7.\346\267\261\346\220\234\347\211\210.md" | 4 +- ...2.\345\277\253\344\271\220\346\225\260.md" | 0 ...76\350\241\250\345\205\203\347\264\240.md" | 12 +- ...04\345\255\227\347\254\246\344\270\262.md" | 0 ...73\350\275\254\351\223\276\350\241\250.md" | 4 +- ...04\345\255\220\346\225\260\347\273\204.md" | 4 +- ...\345\256\266\345\212\253\350\210\215II.md" | 6 +- ...345\220\210\346\200\273\345\222\214III.md" | 6 +- ...02\347\202\271\344\270\252\346\225\260.md" | 12 +- ...27\345\256\236\347\216\260\346\240\210.md" | 2 +- ...54\344\272\214\345\217\211\346\240\221.md" | 6 +- ...36\347\216\260\351\230\237\345\210\227.md" | 2 +- ...36\346\226\207\351\223\276\350\241\250.md" | 2 +- ...54\345\205\261\347\245\226\345\205\210.md" | 6 +- ...54\345\205\261\347\245\226\345\205\210.md" | 12 +- ...43\346\234\200\345\244\247\345\200\274.md" | 6 +- ...15\345\274\202\344\275\215\350\257\215.md" | 2 +- ...00\346\234\211\350\267\257\345\276\204.md" | 6 +- ...50\345\271\263\346\226\271\346\225\260.md" | 2 +- ...3.\347\247\273\345\212\250\351\233\266.md" | 2 +- ...07\345\255\220\345\272\217\345\210\227.md" | 2 +- ...53\345\206\267\345\206\273\346\234\237.md" | 4 +- ...66\351\222\261\345\205\221\346\215\242.md" | 2 +- ...11\346\216\222\350\241\214\347\250\213.md" | 6 +- ...345\256\266\345\212\253\350\210\215III.md" | 4 +- ...64\346\225\260\346\213\206\345\210\206.md" | 2 +- ...54\345\255\227\347\254\246\344\270\262.md" | 2 +- ...30\351\242\221\345\205\203\347\264\240.md" | 2 +- ...04\347\232\204\344\272\244\351\233\206.md" | 4 +- ...06\345\212\250\345\272\217\345\210\227.md" | 12 +- ...10\346\200\273\345\222\214\342\205\243.md" | 2 +- ...3.\350\265\216\351\207\221\344\277\241.md" | 0 ...55\345\255\220\345\272\217\345\210\227.md" | 6 +- ...66\345\255\220\344\271\213\345\222\214.md" | 6 +- ...15\345\273\272\351\230\237\345\210\227.md" | 2 +- ...11\345\222\214\345\255\220\351\233\206.md" | 2 +- ...64\346\265\201\351\227\256\351\242\230.md" | 6 +- ...15\345\217\240\345\214\272\351\227\264.md" | 2 +- ...55\347\232\204\350\212\202\347\202\271.md" | 4 +- ...25\347\210\206\346\260\224\347\220\203.md" | 2 +- ...\346\225\260\347\233\270\345\212\240II.md" | 0 ...06\345\217\221\351\245\274\345\271\262.md" | 4 +- ...20\345\255\227\347\254\246\344\270\262.md" | 32 +- ...77\347\232\204\345\221\250\351\225\277.md" | 6 +- ...4.\344\270\200\345\222\214\351\233\266.md" | 4 +- ...36\345\255\220\345\272\217\345\210\227.md" | 4 +- ...4.\347\233\256\346\240\207\345\222\214.md" | 30 +- ...4\345\244\247\345\205\203\347\264\240I.md" | 0 ...55\347\232\204\344\274\227\346\225\260.md" | 4 +- ...\345\244\247\345\205\203\347\264\240II.md" | 0 ...42\351\202\243\345\245\221\346\225\260.md" | 0 ...13\350\247\222\347\232\204\345\200\274.md" | 4 +- ...07\345\255\220\345\272\217\345\210\227.md" | 8 +- ...\351\222\261\345\205\221\346\215\242II.md" | 4 +- ...17\347\273\235\345\257\271\345\267\256.md" | 4 +- ...72\347\264\257\345\212\240\346\240\221.md" | 4 +- ...\345\255\227\347\254\246\344\270\262II.md" | 2 +- ...40\351\231\244\346\223\215\344\275\234.md" | 2 +- ...66\344\272\214\345\217\211\346\240\221.md" | 4 +- ...36\346\226\207\345\255\220\344\270\262.md" | 6 +- ...a2\345\217\202\350\256\256\351\231\242.md" | 0 ...47\344\272\214\345\217\211\346\240\221.md" | 4 +- ...24\345\233\236\345\216\237\347\202\271.md" | 2 +- ...11\346\220\234\347\264\242\346\240\221.md" | 10 +- ...27\347\232\204\344\270\252\346\225\260.md" | 2 +- ...22\345\242\236\345\272\217\345\210\227.md" | 2 +- ...27\344\275\231\350\277\236\346\216\245.md" | 6 +- ...\344\275\231\350\277\236\346\216\245II.md" | 8 +- ...00\345\244\247\351\235\242\347\247\257.md" | 4 +- ...55\347\232\204\346\220\234\347\264\242.md" | 4 +- ...22\345\205\245\346\223\215\344\275\234.md" | 4 +- ...14\345\210\206\346\237\245\346\211\276.md" | 4 +- ...76\350\256\241\351\223\276\350\241\250.md" | 6 +- ...53\346\211\213\347\273\255\350\264\271.md" | 0 ...01\350\247\204\345\210\222\357\274\211.md" | 0 ...15\345\255\220\346\225\260\347\273\204.md" | 4 +- ...55\345\277\203\347\264\242\345\274\225.md" | 0 ...36\347\232\204\346\225\260\345\255\227.md" | 0 ...17\346\227\245\346\270\251\345\272\246.md" | 24 +- ...66\350\277\237\346\227\266\351\227\264.md" | 46 +-- ...71\347\210\254\346\245\274\346\242\257.md" | 4 +- ...27\346\257\215\345\214\272\351\227\264.md" | 2 +- ...34\347\232\204\350\210\252\347\217\255.md" | 6 +- ...75\347\232\204\350\267\257\345\276\204.md" | 4 +- ...47\344\272\272\345\267\245\345\262\233.md" | 6 +- ...31\345\222\214\346\210\277\351\227\264.md" | 4 +- ...04\345\255\227\347\254\246\344\270\262.md" | 2 +- ...54\346\260\264\346\211\276\351\233\266.md" | 0 ...\345\272\217\346\225\260\347\273\204II.md" | 0 ...77\346\214\211\351\224\256\345\205\245.md" | 2 +- ...61\350\204\211\346\225\260\347\273\204.md" | 4 +- ...47\344\272\214\345\217\211\346\240\221.md" | 10 +- ...04\347\232\204\345\271\263\346\226\271.md" | 2 +- ...70\347\224\250\345\255\227\347\254\246.md" | 2 +- ...04\346\225\260\347\273\204\345\222\214.md" | 0 ...60\347\232\204\346\225\260\351\207\217.md" | 8 +- ...70\344\272\244\347\232\204\347\272\277.md" | 4 +- ...73\351\207\215\345\244\215\351\241\271.md" | 2 +- ...\347\232\204\351\207\215\351\207\217II.md" | 2 +- ...61\345\255\220\345\272\217\345\210\227.md" | 4 +- ...72\347\216\260\346\254\241\346\225\260.md" | 2 +- ...41\345\255\227\347\254\246\344\270\262.md" | 0 ...77\347\232\204\346\225\260\347\233\256.md" | 4 +- ...60\347\233\256\346\216\222\345\272\217.md" | 2 +- ...27\347\232\204\346\225\260\345\255\227.md" | 2 +- ...21\345\217\230\345\271\263\350\241\241.md" | 2 +- ...55\345\277\203\350\212\202\347\202\271.md" | 2 +- ...30\345\234\250\350\267\257\345\276\204.md" | 2 +- ...57\345\244\232\345\244\247\357\274\237.md" | 10 +- ...55\344\271\260\345\234\237\345\234\260.md" | 1 + ...17\202\344\274\232dijkstra\345\240\206.md" | 15 +- ...74\232dijkstra\346\234\264\347\264\240.md" | 41 +-- .../0053.\345\257\273\345\256\235-Kruskal.md" | 21 +- .../0053.\345\257\273\345\256\235-prim.md" | 23 +- ...77\346\215\242\346\225\260\345\255\227.md" | 5 +- ...13\345\255\227\347\254\246\344\270\262.md" | 9 +- ...8.\345\214\272\351\227\264\345\222\214.md" | 5 +- ...\211\251\350\277\220\350\276\223I-SPFA.md" | 21 +- ...7\347\211\251\350\277\220\350\276\223I.md" | 21 +- ...\347\211\251\350\277\220\350\276\223II.md" | 5 +- ...347\211\251\350\277\220\350\276\223III.md" | 41 +-- ...16\351\200\233\345\205\254\345\233\255.md" | 13 +- ...57\350\276\276\350\267\257\345\276\204.md" | 5 +- ...60\351\207\217\345\271\277\346\220\234.md" | 7 +- ...60\351\207\217\346\267\261\346\220\234.md" | 5 +- ...00\345\244\247\351\235\242\347\247\257.md" | 5 +- ...04\346\200\273\351\235\242\347\247\257.md" | 7 +- ...11\346\262\241\345\255\244\345\262\233.md" | 7 +- ...64\346\265\201\351\227\256\351\242\230.md" | 7 +- ...00\345\244\247\345\262\233\345\261\277.md" | 11 +- ...50\345\217\257\350\276\276\346\200\247.md" | 5 +- ...77\347\232\204\345\221\250\351\225\277.md" | 9 +- ...50\347\232\204\350\267\257\345\276\204.md" | 3 +- ...27\344\275\231\350\277\236\346\216\245.md" | 13 +- ...\344\275\231\350\277\236\346\216\245II.md" | 13 +- ...46\344\270\262\346\216\245\351\276\231.md" | 5 +- ...57\344\273\266\346\236\204\345\273\272.md" | 23 +- ...7\232\204\346\224\273\345\207\273astar.md" | 9 +- ...347\224\250ACM\346\250\241\345\274\217.md" | 1 + ...06\350\256\272\345\237\272\347\241\200.md" | 25 +- ...06\350\256\272\345\237\272\347\241\200.md" | 7 +- ...72\346\200\273\347\273\223\347\257\207.md" | 1 + ...06\350\256\272\345\237\272\347\241\200.md" | 15 +- ...06\350\256\272\345\237\272\347\241\200.md" | 31 +- ...30\346\200\273\347\273\223\347\257\207.md" | 3 +- problems/qita/acm.md | 20 +- problems/qita/acm_backup.md | 89 +++++ problems/qita/algo_pdf.md | 70 ++++ problems/qita/ewaishuoming.md | 16 + problems/qita/gongkaike.md | 162 +++++++++ problems/qita/join.md | 48 +-- problems/qita/language.md | 22 ++ problems/qita/publish.md | 200 +++++++++++ problems/qita/say_feel.md | 14 + problems/qita/server.md | 6 +- problems/qita/shejimoshi.md | 14 +- problems/qita/tulunfabu.md | 34 +- problems/qita/tulunshuoming.md | 44 +++ problems/qita/update.md | 56 ++++ ...11\346\255\245\351\223\272\345\236\253.md" | 0 ...46\347\235\200\345\233\236\346\272\257.md" | 0 ...21\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 16 +- ...00\350\277\255\344\273\243\346\263\225.md" | 2 +- ...55\344\273\243\351\201\215\345\216\206.md" | 6 +- ...22\345\275\222\351\201\215\345\216\206.md" | 0 .../ACM\346\250\241\345\274\217.md" | 18 +- ...72\344\272\214\345\217\211\346\240\221.md" | 18 +- ...50\350\277\231\351\207\214\344\272\206.md" | 2 +- .../\345\211\215\345\272\217/gitserver.md" | 312 ++++++++++++++++++ .../\345\211\215\345\272\217/kvstore.md" | 124 +++++++ "problems/\345\211\215\345\272\217/server.md" | 129 ++++++++ "problems/\345\211\215\345\272\217/vim.md" | 4 +- ...54\345\217\270\346\200\273\347\273\223.md" | 125 ------- ...24\345\217\221\346\265\201\347\250\213.md" | 240 -------------- ...43\347\240\201\351\243\216\346\240\274.md" | 4 +- ...05\345\255\230\346\266\210\350\200\227.md" | 10 +- ...26\350\257\221\350\277\220\350\241\214.md" | 2 +- ...54\345\217\270\346\200\273\347\273\223.md" | 109 ------ ...54\345\217\270\346\200\273\347\273\223.md" | 77 ----- ...54\345\217\270\346\200\273\347\273\223.md" | 72 ---- ...64\345\244\215\346\235\202\345\272\246.md" | 8 +- ...54\345\217\270\346\200\273\347\273\223.md" | 83 ----- ...54\345\217\270\346\200\273\347\273\223.md" | 79 ----- ...07\346\241\243\345\267\245\345\205\267.md" | 2 +- ...17\345\221\230\347\256\200\345\216\206.md" | 6 +- ...64\345\244\215\346\235\202\345\272\246.md" | 2 +- ...27\346\263\225\350\266\205\346\227\266.md" | 12 +- ...02\345\272\246\345\210\206\346\236\220.md" | 8 +- ...64\345\244\215\346\235\202\345\272\246.md" | 6 +- ...77\346\215\242\347\251\272\346\240\274.md" | 4 +- ...54\345\255\227\347\254\246\344\270\262.md" | 8 +- ...30\346\200\273\347\273\223\347\257\207.md" | 2 +- ...22\346\200\273\347\273\223\347\257\207.md" | 6 +- ...06\350\256\272\345\237\272\347\241\200.md" | 2 +- ...07\351\222\210\346\200\273\347\273\223.md" | 0 ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 4 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 12 +- ...50\346\234\253\346\200\273\347\273\223.md" | 14 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 12 +- ...50\346\234\253\346\200\273\347\273\223.md" | 4 +- ...50\346\234\253\346\200\273\347\273\223.md" | 6 +- ...50\346\234\253\346\200\273\347\273\223.md" | 10 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 14 +- ...50\346\234\253\346\200\273\347\273\223.md" | 8 +- ...50\346\234\253\346\200\273\347\273\223.md" | 6 +- ...50\346\234\253\346\200\273\347\273\223.md" | 2 +- ...50\346\234\253\346\200\273\347\273\223.md" | 12 +- ...50\346\234\253\346\200\273\347\273\223.md" | 8 +- ...23\347\263\273\345\210\227\344\270\200.md" | 2 +- ...14\350\241\250\346\200\273\347\273\223.md" | 0 ...06\350\256\272\345\237\272\347\241\200.md" | 12 +- ...36\346\272\257\346\200\273\347\273\223.md" | 42 +-- ...00\347\247\215\345\206\231\346\263\225.md" | 4 +- ...06\350\256\272\345\237\272\347\241\200.md" | 4 +- ...46\344\270\262\346\200\273\347\273\223.md" | 0 ...04\346\200\273\347\273\223\347\257\207.md" | 10 +- ...06\350\256\272\345\237\272\347\241\200.md" | 10 +- ...37\345\210\227\346\200\273\347\273\223.md" | 0 ...06\350\256\272\345\237\272\347\241\200.md" | 6 +- ...06\350\256\262\350\247\243\357\274\211.md" | 8 +- ...27\346\263\225\346\250\241\346\235\277.md" | 0 ...05\346\200\273\347\273\223\347\257\207.md" | 4 +- ...47\241\20001\350\203\214\345\214\205-1.md" | 26 +- ...47\241\20001\350\203\214\345\214\205-2.md" | 2 +- ...14\345\214\205\344\270\200\347\273\264.md" | 4 +- ...32\351\207\215\350\203\214\345\214\205.md" | 0 ...14\345\205\250\350\203\214\345\214\205.md" | 10 +- ...25\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 2 +- ...02\345\272\246\345\210\206\346\236\220.md" | 281 ++++++++++++++++ ...50\346\200\273\347\273\223\347\257\207.md" | 2 +- ...06\350\256\272\345\237\272\347\241\200.md" | 14 +- ...76\350\241\250\347\233\270\344\272\244.md" | 12 +- 315 files changed, 2499 insertions(+), 1729 deletions(-) mode change 100644 => 100755 "problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" mode change 100644 => 100755 "problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" mode change 100644 => 100755 "problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" mode change 100644 => 100755 "problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" mode change 100644 => 100755 "problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" mode change 100644 => 100755 "problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" mode change 100644 => 100755 "problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" mode change 100644 => 100755 "problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" mode change 100644 => 100755 "problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" mode change 100644 => 100755 "problems/0028.\345\256\236\347\216\260strStr.md" mode change 100644 => 100755 "problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" mode change 100644 => 100755 "problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" mode change 100644 => 100755 "problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" mode change 100644 => 100755 "problems/0037.\350\247\243\346\225\260\347\213\254.md" mode change 100644 => 100755 "problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" mode change 100644 => 100755 "problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" mode change 100644 => 100755 "problems/0042.\346\216\245\351\233\250\346\260\264.md" mode change 100644 => 100755 "problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" mode change 100644 => 100755 "problems/0046.\345\205\250\346\216\222\345\210\227.md" mode change 100644 => 100755 "problems/0047.\345\205\250\346\216\222\345\210\227II.md" mode change 100644 => 100755 "problems/0051.N\347\232\207\345\220\216.md" mode change 100644 => 100755 "problems/0052.N\347\232\207\345\220\216II.md" mode change 100644 => 100755 "problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" mode change 100644 => 100755 "problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" mode change 100644 => 100755 "problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" mode change 100644 => 100755 "problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" mode change 100644 => 100755 "problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" mode change 100644 => 100755 "problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" mode change 100644 => 100755 "problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" mode change 100644 => 100755 "problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" mode change 100644 => 100755 "problems/0070.\347\210\254\346\245\274\346\242\257.md" mode change 100644 => 100755 "problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" mode change 100644 => 100755 "problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" mode change 100644 => 100755 "problems/0077.\347\273\204\345\220\210.md" mode change 100644 => 100755 "problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" mode change 100644 => 100755 "problems/0078.\345\255\220\351\233\206.md" mode change 100644 => 100755 "problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" mode change 100644 => 100755 "problems/0090.\345\255\220\351\233\206II.md" mode change 100644 => 100755 "problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" mode change 100644 => 100755 "problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" mode change 100644 => 100755 "problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" mode change 100644 => 100755 "problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" mode change 100644 => 100755 "problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" mode change 100644 => 100755 "problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" mode change 100644 => 100755 "problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" mode change 100644 => 100755 "problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" mode change 100644 => 100755 "problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" mode change 100644 => 100755 "problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" mode change 100644 => 100755 "problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" mode change 100644 => 100755 "problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" mode change 100644 => 100755 "problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" mode change 100644 => 100755 "problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" mode change 100644 => 100755 "problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" mode change 100644 => 100755 "problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" mode change 100644 => 100755 "problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" mode change 100644 => 100755 "problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" mode change 100644 => 100755 "problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" mode change 100644 => 100755 "problems/0134.\345\212\240\346\262\271\347\253\231.md" mode change 100644 => 100755 "problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" mode change 100644 => 100755 "problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" mode change 100644 => 100755 "problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" mode change 100644 => 100755 "problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" mode change 100644 => 100755 "problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" mode change 100644 => 100755 "problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" mode change 100644 => 100755 "problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" mode change 100644 => 100755 "problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" mode change 100644 => 100755 "problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" mode change 100644 => 100755 "problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" mode change 100644 => 100755 "problems/0202.\345\277\253\344\271\220\346\225\260.md" mode change 100644 => 100755 "problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" mode change 100644 => 100755 "problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" mode change 100644 => 100755 "problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" mode change 100644 => 100755 "problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" mode change 100644 => 100755 "problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" mode change 100644 => 100755 "problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" mode change 100644 => 100755 "problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" mode change 100644 => 100755 "problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" mode change 100644 => 100755 "problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" mode change 100644 => 100755 "problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" mode change 100644 => 100755 "problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" mode change 100644 => 100755 "problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" mode change 100644 => 100755 "problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" mode change 100644 => 100755 "problems/0283.\347\247\273\345\212\250\351\233\266.md" mode change 100644 => 100755 "problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" mode change 100644 => 100755 "problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" mode change 100644 => 100755 "problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" mode change 100644 => 100755 "problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" mode change 100644 => 100755 "problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" mode change 100644 => 100755 "problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" mode change 100644 => 100755 "problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" mode change 100644 => 100755 "problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" mode change 100644 => 100755 "problems/0383.\350\265\216\351\207\221\344\277\241.md" mode change 100644 => 100755 "problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" mode change 100644 => 100755 "problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" mode change 100644 => 100755 "problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" mode change 100644 => 100755 "problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" mode change 100644 => 100755 "problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" mode change 100644 => 100755 "problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" mode change 100644 => 100755 "problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" mode change 100644 => 100755 "problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" mode change 100644 => 100755 "problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" mode change 100644 => 100755 "problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" mode change 100644 => 100755 "problems/0474.\344\270\200\345\222\214\351\233\266.md" mode change 100644 => 100755 "problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0494.\347\233\256\346\240\207\345\222\214.md" mode change 100644 => 100755 "problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" mode change 100644 => 100755 "problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" mode change 100644 => 100755 "problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" mode change 100644 => 100755 "problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" mode change 100644 => 100755 "problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" mode change 100644 => 100755 "problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" mode change 100644 => 100755 "problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" mode change 100644 => 100755 "problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" mode change 100644 => 100755 "problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" mode change 100644 => 100755 "problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" mode change 100644 => 100755 "problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" mode change 100644 => 100755 "problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" mode change 100644 => 100755 "problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" mode change 100644 => 100755 "problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" mode change 100644 => 100755 "problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" mode change 100644 => 100755 "problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" mode change 100644 => 100755 "problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" mode change 100644 => 100755 "problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" mode change 100644 => 100755 "problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" mode change 100644 => 100755 "problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" mode change 100644 => 100755 "problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" mode change 100644 => 100755 "problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" mode change 100644 => 100755 "problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" mode change 100644 => 100755 "problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" mode change 100644 => 100755 "problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" mode change 100644 => 100755 "problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" mode change 100644 => 100755 "problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" mode change 100644 => 100755 "problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" mode change 100644 => 100755 "problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" mode change 100644 => 100755 "problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" mode change 100644 => 100755 "problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" mode change 100644 => 100755 "problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" mode change 100644 => 100755 "problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" mode change 100644 => 100755 "problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" mode change 100644 => 100755 "problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" mode change 100644 => 100755 "problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" mode change 100644 => 100755 "problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" mode change 100644 => 100755 "problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" mode change 100644 => 100755 "problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" mode change 100644 => 100755 "problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" mode change 100644 => 100755 "problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" mode change 100644 => 100755 "problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" mode change 100644 => 100755 "problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" mode change 100644 => 100755 "problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" mode change 100644 => 100755 "problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" mode change 100644 => 100755 "problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" mode change 100644 => 100755 "problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" mode change 100644 => 100755 "problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" mode change 100644 => 100755 "problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" mode change 100644 => 100755 "problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" mode change 100644 => 100755 "problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" mode change 100644 => 100755 "problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" mode change 100644 => 100755 "problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" create mode 100755 problems/qita/acm_backup.md create mode 100755 problems/qita/algo_pdf.md create mode 100755 problems/qita/ewaishuoming.md create mode 100755 problems/qita/gongkaike.md create mode 100755 problems/qita/language.md create mode 100755 problems/qita/publish.md create mode 100755 problems/qita/say_feel.md create mode 100755 problems/qita/tulunshuoming.md create mode 100755 problems/qita/update.md mode change 100644 => 100755 "problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" mode change 100644 => 100755 "problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" create mode 100755 "problems/\345\211\215\345\272\217/gitserver.md" create mode 100755 "problems/\345\211\215\345\272\217/kvstore.md" create mode 100755 "problems/\345\211\215\345\272\217/server.md" delete mode 100644 "problems/\345\211\215\345\272\217/\344\270\212\346\265\267\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" delete mode 100644 "problems/\345\211\215\345\272\217/\344\272\222\350\201\224\347\275\221\345\244\247\345\216\202\347\240\224\345\217\221\346\265\201\347\250\213.md" delete mode 100644 "problems/\345\211\215\345\272\217/\345\214\227\344\272\254\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" delete mode 100644 "problems/\345\211\215\345\272\217/\345\271\277\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" delete mode 100644 "problems/\345\211\215\345\272\217/\346\210\220\351\203\275\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" delete mode 100644 "problems/\345\211\215\345\272\217/\346\235\255\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" delete mode 100644 "problems/\345\211\215\345\272\217/\346\267\261\345\234\263\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" mode change 100644 => 100755 "problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" mode change 100644 => 100755 "problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" mode change 100644 => 100755 "problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" mode change 100644 => 100755 "problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" mode change 100644 => 100755 "problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" mode change 100644 => 100755 "problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" mode change 100644 => 100755 "problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" mode change 100644 => 100755 "problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" mode change 100644 => 100755 "problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" mode change 100644 => 100755 "problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" create mode 100755 "problems/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" mode change 100644 => 100755 "problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" mode change 100644 => 100755 "problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" mode change 100644 => 100755 "problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" diff --git a/README.md b/README.md index 06de2f5d0e..993d7c6df8 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ 题目分类大纲如下: -二叉树大纲 +二叉树大纲 1. [关于二叉树,你该了解这些!](./problems/二叉树理论基础.md) 2. [二叉树:二叉树的递归遍历](./problems/二叉树的递归遍历.md) @@ -222,7 +222,7 @@ 题目分类大纲如下: -回溯算法大纲 +回溯算法大纲 1. [关于回溯算法,你该了解这些!](./problems/回溯算法理论基础.md) 2. [回溯算法:77.组合](./problems/0077.组合.md) @@ -252,7 +252,7 @@ 题目分类大纲如下: -贪心算法大纲 +贪心算法大纲 1. [关于贪心算法,你该了解这些!](./problems/贪心算法理论基础.md) 2. [贪心算法:455.分发饼干](./problems/0455.分发饼干.md) @@ -283,7 +283,7 @@ 动态规划专题已经开始啦,来不及解释了,小伙伴们上车别掉队! - + 1. [关于动态规划,你该了解这些!](./problems/动态规划理论基础.md) 2. [动态规划:509.斐波那契数](./problems/0509.斐波那契数.md) 3. [动态规划:70.爬楼梯](./problems/0070.爬楼梯.md) @@ -297,7 +297,7 @@ 背包问题系列: -背包问题大纲 +背包问题大纲 11. [动态规划:01背包理论基础(二维dp数组)](./problems/背包理论基础01背包-1.md) @@ -328,7 +328,7 @@ 股票系列: -股票问题总结 +股票问题总结 32. [动态规划:121.买卖股票的最佳时机](./problems/0121.买卖股票的最佳时机.md) @@ -343,7 +343,7 @@ 子序列系列: - + 41. [动态规划:300.最长递增子序列](./problems/0300.最长上升子序列.md) @@ -503,5 +503,5 @@ 添加微信记得备注,如果是已工作,备注:姓名-城市-岗位。如果学生,备注:姓名-学校-年级。**备注没有自我介绍不通过哦** -
+
diff --git "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" old mode 100644 new mode 100755 index f9bea8289e..a11527961d --- "a/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0001.\344\270\244\346\225\260\344\271\213\345\222\214.md" @@ -83,10 +83,10 @@ map目的用来存放我们访问过的元素,因为遍历数组的时候, 过程如下: -![过程一](https://file.kamacoder.com/pics/20220711202638.png) +![过程一](https://file1.kamacoder.com/i/algo/20220711202638.png) -![过程二](https://file.kamacoder.com/pics/20230220223536.png) +![过程二](https://file1.kamacoder.com/i/algo/20230220223536.png) C++代码: diff --git "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" old mode 100644 new mode 100755 index 1e0667e575..05dd610a72 --- "a/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0005.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -106,7 +106,7 @@ dp[i][j]可以初始化为true么? 当然不行,怎能刚开始就全都匹 dp[i + 1][j - 1] 在 dp[i][j]的左下角,如图: -![647.回文子串](https://file.kamacoder.com/pics/20210121171032473.jpg) +![647.回文子串](https://file1.kamacoder.com/i/algo/20210121171032473.jpg) 如果这矩阵是从上到下,从左到右遍历,那么会用到没有计算过的dp[i + 1][j - 1],也就是根据不确定是不是回文的区间[i+1,j-1],来判断了[i,j]是不是回文,那结果一定是不对的。 @@ -140,7 +140,7 @@ for (int i = s.size() - 1; i >= 0; i--) { // 注意遍历顺序 举例,输入:"aaa",dp[i][j]状态如下: -![647.回文子串1](https://file.kamacoder.com/pics/20210121171059951.jpg) +![647.回文子串1](https://file1.kamacoder.com/i/algo/20210121171059951.jpg) **注意因为dp[i][j]的定义,所以j一定是大于等于i的,那么在填充dp[i][j]的时候一定是只填充右上半部分**。 diff --git "a/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" "b/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" old mode 100644 new mode 100755 index 52dbdab7b5..e2cb3f4612 --- "a/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" +++ "b/problems/0015.\344\270\211\346\225\260\344\271\213\345\222\214.md" @@ -100,7 +100,7 @@ public: 动画效果如下: -![15.三数之和](https://code-thinking.cdn.bcebos.com/gifs/15.%E4%B8%89%E6%95%B0%E4%B9%8B%E5%92%8C.gif) +![15.三数之和](https://file1.kamacoder.com/i/algo/15.%E4%B8%89%E6%95%B0%E4%B9%8B%E5%92%8C.gif) 拿这个nums数组来举例,首先将数组排序,然后有一层for循环,i从下标0的地方开始,同时定一个下标left 定义在i+1的位置上,定义下标right 在数组结尾的位置上。 diff --git "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" old mode 100644 new mode 100755 index a35fd4e2bc..6dcf9ee690 --- "a/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" +++ "b/problems/0017.\347\224\265\350\257\235\345\217\267\347\240\201\347\232\204\345\255\227\346\257\215\347\273\204\345\220\210.md" @@ -11,7 +11,7 @@ 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 -![17.电话号码的字母组合](https://file.kamacoder.com/pics/2020102916424043.png) +![17.电话号码的字母组合](https://file1.kamacoder.com/i/algo/2020102916424043.png) 示例: * 输入:"23" @@ -64,7 +64,7 @@ const string letterMap[10] = { 例如:输入:"23",抽象为树形结构,如图所示: -![17. 电话号码的字母组合](https://file.kamacoder.com/pics/20201123200304469.png) +![17. 电话号码的字母组合](https://file1.kamacoder.com/i/algo/20201123200304469.png) 图中可以看出遍历的深度,就是输入"23"的长度,而叶子节点就是我们要收集的结果,输出["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]。 diff --git "a/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" "b/problems/0018.\345\233\233\346\225\260\344\271\213\345\222\214.md" old mode 100644 new mode 100755 diff --git "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" old mode 100644 new mode 100755 index 9b2ba88ef8..08f602c1c1 --- "a/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" +++ "b/problems/0019.\345\210\240\351\231\244\351\223\276\350\241\250\347\232\204\345\200\222\346\225\260\347\254\254N\344\270\252\350\212\202\347\202\271.md" @@ -16,7 +16,7 @@ 示例 1: -![19.删除链表的倒数第N个节点](https://file.kamacoder.com/pics/20210510085957392.png) +![19.删除链表的倒数第N个节点](https://file1.kamacoder.com/i/algo/20210510085957392.png) 输入:head = [1,2,3,4,5], n = 2 输出:[1,2,3,5] @@ -49,16 +49,16 @@ * 定义fast指针和slow指针,初始值为虚拟头结点,如图: - + * fast首先走n + 1步 ,为什么是n+1呢,因为只有这样同时移动的时候slow才能指向删除节点的上一个节点(方便做删除操作),如图: - + * fast和slow同时移动,直到fast指向末尾,如题: - + //图片中有错别词:应该将“只到”改为“直到” * 删除slow指向的下一个节点,如图: - + 此时不难写出如下C++代码: diff --git "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" old mode 100644 new mode 100755 index 7282471285..09cf997839 --- "a/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" +++ "b/problems/0020.\346\234\211\346\225\210\347\232\204\346\213\254\345\217\267.md" @@ -81,13 +81,13 @@ cd a/b/c/../../ 1. 第一种情况,字符串里左方向的括号多余了 ,所以不匹配。 -![括号匹配1](https://file.kamacoder.com/pics/2020080915505387.png) +![括号匹配1](https://file1.kamacoder.com/i/algo/2020080915505387.png) 2. 第二种情况,括号没有多余,但是 括号的类型没有匹配上。 -![括号匹配2](https://file.kamacoder.com/pics/20200809155107397.png) +![括号匹配2](https://file1.kamacoder.com/i/algo/20200809155107397.png) 3. 第三种情况,字符串里右方向的括号多余了,所以不匹配。 -![括号匹配3](https://file.kamacoder.com/pics/20200809155115779.png) +![括号匹配3](https://file1.kamacoder.com/i/algo/20200809155115779.png) @@ -95,7 +95,7 @@ cd a/b/c/../../ 动画如下: -![20.有效括号](https://code-thinking.cdn.bcebos.com/gifs/20.有效括号.gif) +![20.有效括号](https://file1.kamacoder.com/i/algo/20.有效括号.gif) 第一种情况:已经遍历完了字符串,但是栈不为空,说明有相应的左括号没有右括号来匹配,所以return false diff --git "a/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" "b/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" old mode 100644 new mode 100755 index b9494297e4..14d2538f45 --- "a/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" +++ "b/problems/0024.\344\270\244\344\270\244\344\272\244\346\215\242\351\223\276\350\241\250\344\270\255\347\232\204\350\212\202\347\202\271.md" @@ -12,7 +12,7 @@ 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 -24.两两交换链表中的节点-题意 +24.两两交换链表中的节点-题意 ## 算法公开课 @@ -31,16 +31,16 @@ 初始时,cur指向虚拟头结点,然后进行如下三步: -![24.两两交换链表中的节点1](https://code-thinking.cdn.bcebos.com/pics/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B91.png) +![24.两两交换链表中的节点1](https://file1.kamacoder.com/i/algo/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B91.png) 操作之后,链表如下: -![24.两两交换链表中的节点2](https://code-thinking.cdn.bcebos.com/pics/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B92.png) +![24.两两交换链表中的节点2](https://file1.kamacoder.com/i/algo/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B92.png) 看这个可能就更直观一些了: -![24.两两交换链表中的节点3](https://code-thinking.cdn.bcebos.com/pics/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B93.png) +![24.两两交换链表中的节点3](https://file1.kamacoder.com/i/algo/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B93.png) 对应的C++代码实现如下: (注释中详细和如上图中的三步做对应) @@ -81,7 +81,7 @@ public: 心想应该没有更好的方法了吧,也就 $O(n)$ 的时间复杂度,重复提交几次,这样了: -![24.两两交换链表中的节点](https://code-thinking.cdn.bcebos.com/pics/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9.png) +![24.两两交换链表中的节点](https://file1.kamacoder.com/i/algo/24.%E4%B8%A4%E4%B8%A4%E4%BA%A4%E6%8D%A2%E9%93%BE%E8%A1%A8%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9.png) 力扣上的统计如果两份代码是 100ms 和 300ms的耗时,其实是需要注意的。 diff --git "a/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" "b/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" old mode 100644 new mode 100755 index d01765ff66..47e05eec6a --- "a/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" +++ "b/problems/0027.\347\247\273\351\231\244\345\205\203\347\264\240.md" @@ -43,7 +43,7 @@ 删除过程如下: -![27.移除元素-暴力解法](https://code-thinking.cdn.bcebos.com/gifs/27.%E7%A7%BB%E9%99%A4%E5%85%83%E7%B4%A0-%E6%9A%B4%E5%8A%9B%E8%A7%A3%E6%B3%95.gif) +![27.移除元素-暴力解法](https://file1.kamacoder.com/i/algo/27.%E7%A7%BB%E9%99%A4%E5%85%83%E7%B4%A0-%E6%9A%B4%E5%8A%9B%E8%A7%A3%E6%B3%95.gif) 很明显暴力解法的时间复杂度是O(n^2),这道题目暴力解法在leetcode上是可以过的。 @@ -87,7 +87,7 @@ public: 删除过程如下: -![27.移除元素-双指针法](https://code-thinking.cdn.bcebos.com/gifs/27.%E7%A7%BB%E9%99%A4%E5%85%83%E7%B4%A0-%E5%8F%8C%E6%8C%87%E9%92%88%E6%B3%95.gif) +![27.移除元素-双指针法](https://file1.kamacoder.com/i/algo/27.%E7%A7%BB%E9%99%A4%E5%85%83%E7%B4%A0-%E5%8F%8C%E6%8C%87%E9%92%88%E6%B3%95.gif) 很多同学不了解 diff --git "a/problems/0028.\345\256\236\347\216\260strStr.md" "b/problems/0028.\345\256\236\347\216\260strStr.md" old mode 100644 new mode 100755 index b25cb301f9..ef8a6c58e6 --- "a/problems/0028.\345\256\236\347\216\260strStr.md" +++ "b/problems/0028.\345\256\236\347\216\260strStr.md" @@ -106,7 +106,7 @@ next数组就是一个前缀表(prefix table)。 如动画所示: -![KMP详解1](https://code-thinking.cdn.bcebos.com/gifs/KMP%E7%B2%BE%E8%AE%B21.gif) +![KMP详解1](https://file1.kamacoder.com/i/algo/KMP%E7%B2%BE%E8%AE%B21.gif) 动画里,我特意把 子串`aa` 标记上了,这是有原因的,大家先注意一下,后面还会说到。 @@ -147,11 +147,11 @@ next数组就是一个前缀表(prefix table)。 这就是前缀表,那为啥就能告诉我们 上次匹配的位置,并跳过去呢? 回顾一下,刚刚匹配的过程在下标5的地方遇到不匹配,模式串是指向f,如图: -KMP精讲1 +KMP精讲1 然后就找到了下标2,指向b,继续匹配:如图: -KMP精讲2 +KMP精讲2 以下这句话,对于理解为什么使用前缀表可以告诉我们匹配失败之后跳到哪里重新匹配 非常重要! @@ -167,15 +167,15 @@ next数组就是一个前缀表(prefix table)。 如图: -KMP精讲5 +KMP精讲5 长度为前1个字符的子串`a`,最长相同前后缀的长度为0。(注意字符串的**前缀是指不包含最后一个字符的所有以第一个字符开头的连续子串**;**后缀是指不包含第一个字符的所有以最后一个字符结尾的连续子串**。) -KMP精讲6 +KMP精讲6 长度为前2个字符的子串`aa`,最长相同前后缀的长度为1。 -KMP精讲7 +KMP精讲7 长度为前3个字符的子串`aab`,最长相同前后缀的长度为0。 @@ -185,13 +185,13 @@ next数组就是一个前缀表(prefix table)。 长度为前6个字符的子串`aabaaf`,最长相同前后缀的长度为0。 那么把求得的最长相同前后缀的长度就是对应前缀表的元素,如图: -KMP精讲8 +KMP精讲8 可以看出模式串与前缀表对应位置的数字表示的就是:**下标i之前(包括i)的字符串中,有多大长度的相同前缀后缀。** 再来看一下如何利用 前缀表找到 当字符不匹配的时候应该指针应该移动的位置。如动画所示: -![KMP精讲2](https://code-thinking.cdn.bcebos.com/gifs/KMP%E7%B2%BE%E8%AE%B22.gif) +![KMP精讲2](https://file1.kamacoder.com/i/algo/KMP%E7%B2%BE%E8%AE%B22.gif) 找到的不匹配的位置, 那么此时我们要看它的前一个字符的前缀表的数值是多少。 @@ -225,7 +225,7 @@ next数组就可以是前缀表,但是很多实现都是把前缀表统一减 匹配过程动画如下: -![KMP精讲4](https://code-thinking.cdn.bcebos.com/gifs/KMP%E7%B2%BE%E8%AE%B24.gif) +![KMP精讲4](https://file1.kamacoder.com/i/algo/KMP%E7%B2%BE%E8%AE%B24.gif) ### 时间复杂度分析 @@ -332,7 +332,7 @@ void getNext(int* next, const string& s){ 代码构造next数组的逻辑流程动画如下: -![KMP精讲3](https://code-thinking.cdn.bcebos.com/gifs/KMP%E7%B2%BE%E8%AE%B23.gif) +![KMP精讲3](https://file1.kamacoder.com/i/algo/KMP%E7%B2%BE%E8%AE%B23.gif) 得到了next数组之后,就要用这个来做匹配了。 diff --git "a/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" "b/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" old mode 100644 new mode 100755 index 95bb1d899e..4bbf20fbb8 --- "a/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" +++ "b/problems/0031.\344\270\213\344\270\200\344\270\252\346\216\222\345\210\227.md" @@ -67,7 +67,7 @@ 以求1243为例,流程如图: - + 对应的C++代码如下: diff --git "a/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" "b/problems/0034.\345\234\250\346\216\222\345\272\217\346\225\260\347\273\204\344\270\255\346\237\245\346\211\276\345\205\203\347\264\240\347\232\204\347\254\254\344\270\200\344\270\252\345\222\214\346\234\200\345\220\216\344\270\200\344\270\252\344\275\215\347\275\256.md" old mode 100644 new mode 100755 diff --git "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" old mode 100644 new mode 100755 index c9826fa205..b48910eef7 --- "a/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" +++ "b/problems/0035.\346\220\234\347\264\242\346\217\222\345\205\245\344\275\215\347\275\256.md" @@ -41,7 +41,7 @@ 这道题目,要在数组中插入目标值,无非是这四种情况。 -![35_搜索插入位置3](https://file.kamacoder.com/pics/20201216232148471.png) +![35_搜索插入位置3](https://file1.kamacoder.com/i/algo/20201216232148471.png) * 目标值在数组所有元素之前 * 目标值等于数组中某一个元素 @@ -82,14 +82,14 @@ public: 效率如下: -![35_搜索插入位置](https://file.kamacoder.com/pics/20201216232127268.png) +![35_搜索插入位置](https://file1.kamacoder.com/i/algo/20201216232127268.png) ### 二分法 既然暴力解法的时间复杂度是O(n),就要尝试一下使用二分查找法。 -![35_搜索插入位置4](https://file.kamacoder.com/pics/202012162326354.png) +![35_搜索插入位置4](https://file1.kamacoder.com/i/algo/202012162326354.png) 大家注意这道题目的前提是数组是有序数组,这也是使用二分查找的基础条件。 @@ -99,7 +99,7 @@ public: 大体讲解一下二分法的思路,这里来举一个例子,例如在这个数组中,使用二分法寻找元素为5的位置,并返回其下标。 -![35_搜索插入位置5](https://file.kamacoder.com/pics/20201216232659199.png) +![35_搜索插入位置5](https://file1.kamacoder.com/i/algo/20201216232659199.png) 二分查找涉及的很多的边界条件,逻辑比较简单,就是写不好。 @@ -150,7 +150,7 @@ public: * 空间复杂度:O(1) 效率如下: -![35_搜索插入位置2](https://file.kamacoder.com/pics/2020121623272877.png) +![35_搜索插入位置2](https://file1.kamacoder.com/i/algo/2020121623272877.png) ### 二分法第二种写法 diff --git "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" old mode 100644 new mode 100755 index 5d2adb4d9d..204f0cc092 --- "a/problems/0037.\350\247\243\346\225\260\347\213\254.md" +++ "b/problems/0037.\350\247\243\346\225\260\347\213\254.md" @@ -18,11 +18,11 @@ 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。 空白格用 '.' 表示。 -![解数独](https://file.kamacoder.com/pics/202011171912586.png) +![解数独](https://file1.kamacoder.com/i/algo/202011171912586.png) 一个数独。 -![解数独](https://file.kamacoder.com/pics/20201117191340669.png) +![解数独](https://file1.kamacoder.com/i/algo/20201117191340669.png) 答案被标成红色。 @@ -52,7 +52,7 @@ 因为这个树形结构太大了,我抽取一部分,如图所示: -![37.解数独](https://file.kamacoder.com/pics/2020111720451790-20230310131816104.png) +![37.解数独](https://file1.kamacoder.com/i/algo/2020111720451790-20230310131816104.png) ### 回溯三部曲 @@ -83,7 +83,7 @@ bool backtracking(vector>& board) * 递归单层搜索逻辑 -![37.解数独](https://file.kamacoder.com/pics/2020111720451790-20230310131822254.png) +![37.解数独](https://file1.kamacoder.com/i/algo/2020111720451790-20230310131822254.png) 在树形图中可以看出我们需要的是一个二维的递归 (一行一列) diff --git "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" old mode 100644 new mode 100755 index 8467277115..d8dac0b45b --- "a/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" +++ "b/problems/0039.\347\273\204\345\220\210\346\200\273\345\222\214.md" @@ -50,7 +50,7 @@ candidates 中的数字可以无限制重复被选取。 本题搜索的过程抽象成树形结构如下: -![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) +![39.组合总和](https://file1.kamacoder.com/i/algo/20201223170730367.png) 注意图中叶子节点的返回条件,因为本题没有组合数量要求,仅仅是总和的限制,所以递归没有层数的限制,只要选取的元素总和超过target,就返回! 而在[77.组合](https://programmercarl.com/0077.组合.html)和[216.组合总和III](https://programmercarl.com/0216.组合总和III.html) 中都可以知道要递归K层,因为要取k个元素的组合。 @@ -85,7 +85,7 @@ void backtracking(vector& candidates, int target, int sum, int startIndex) 在如下树形结构中: -![39.组合总和](https://file.kamacoder.com/pics/20201223170730367-20230310135337214.png) +![39.组合总和](https://file1.kamacoder.com/i/algo/20201223170730367-20230310135337214.png) 从叶子节点可以清晰看到,终止只有两种情况,sum大于target和sum等于target。 @@ -158,7 +158,7 @@ public: 在这个树形结构中: -![39.组合总和](https://file.kamacoder.com/pics/20201223170730367-20230310135342472.png) +![39.组合总和](https://file1.kamacoder.com/i/algo/20201223170730367-20230310135342472.png) 以及上面的版本一的代码大家可以看到,对于sum已经大于target的情况,其实是依然进入了下一层递归,只是下一层递归结束判断的时候,会判断sum > target的话就返回。 @@ -171,7 +171,7 @@ public: 如图: -![39.组合总和1](https://file.kamacoder.com/pics/20201223170809182.png) +![39.组合总和1](https://file1.kamacoder.com/i/algo/20201223170809182.png) for循环剪枝代码如下: diff --git "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" old mode 100644 new mode 100755 index f0cbc2200f..0d3972662f --- "a/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" +++ "b/problems/0040.\347\273\204\345\220\210\346\200\273\345\222\214II.md" @@ -76,7 +76,7 @@ candidates 中的每个数字在每个组合中只能使用一次。 选择过程树形结构如图所示: -![40.组合总和II](https://file.kamacoder.com/pics/20230310000918.png) +![40.组合总和II](https://file1.kamacoder.com/i/algo/20230310000918.png) 可以看到图中,每个节点相对于 [39.组合总和](https://mp.weixin.qq.com/s/FLg8G6EjVcxBjwCbzpACPw)我多加了used数组,这个used数组下面会重点介绍。 @@ -126,7 +126,7 @@ if (sum == target) { 这块比较抽象,如图: -![40.组合总和II1](https://file.kamacoder.com/pics/20230310000954.png) +![40.组合总和II1](https://file1.kamacoder.com/i/algo/20230310000954.png) 我在图中将used的变化用橘黄色标注上,可以看出在candidates[i] == candidates[i - 1]相同的情况下: @@ -137,7 +137,7 @@ if (sum == target) { 而 used[i - 1] == true,说明是进入下一层递归,去下一个数,所以是树枝上,如图所示: -![](https://file.kamacoder.com/pics/20221021163812.png) +![](https://file1.kamacoder.com/i/algo/20221021163812.png) **这块去重的逻辑很抽象,网上搜的题解基本没有能讲清楚的,如果大家之前思考过这个问题或者刷过这道题目,看到这里一定会感觉通透了很多!** diff --git "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" old mode 100644 new mode 100755 index 1e6ec11bc5..c208637b2f --- "a/problems/0042.\346\216\245\351\233\250\346\260\264.md" +++ "b/problems/0042.\346\216\245\351\233\250\346\260\264.md" @@ -47,10 +47,10 @@ 首先要明确,要按照行来计算,还是按照列来计算。 按照行来计算如图: -![42.接雨水2](https://file.kamacoder.com/pics/20210402091118927.png) +![42.接雨水2](https://file1.kamacoder.com/i/algo/20210402091118927.png) 按照列来计算如图: -![42.接雨水1](https://file.kamacoder.com/pics/20210402091208445.png) +![42.接雨水1](https://file1.kamacoder.com/i/algo/20210402091208445.png) 一些同学在实现的时候,很容易一会按照行来计算一会按照列来计算,这样就会越写越乱。 @@ -62,7 +62,7 @@ 这句话可以有点绕,来举一个理解,例如求列4的雨水高度,如图: -![42.接雨水3](https://file.kamacoder.com/pics/20210223092732301.png) +![42.接雨水3](https://file1.kamacoder.com/i/algo/20210223092732301.png) 列4 左侧最高的柱子是列3,高度为2(以下用lHeight表示)。 @@ -201,7 +201,7 @@ public: 1. 首先单调栈是按照行方向来计算雨水,如图: -![42.接雨水2](https://file.kamacoder.com/pics/20210223092629946.png) +![42.接雨水2](https://file1.kamacoder.com/i/algo/20210223092629946.png) 知道这一点,后面的就可以理解了。 @@ -215,7 +215,7 @@ public: 如图: -![42.接雨水4](https://file.kamacoder.com/pics/2021022309321229.png) +![42.接雨水4](https://file1.kamacoder.com/i/algo/2021022309321229.png) 关于单调栈的顺序给大家一个总结: [739. 每日温度](https://programmercarl.com/0739.每日温度.html) 中求一个元素右边第一个更大元素,单调栈就是递增的,[84.柱状图中最大的矩形](https://programmercarl.com/0084.柱状图中最大的矩形.html)求一个元素右边第一个更小元素,单调栈就是递减的。 @@ -229,7 +229,7 @@ public: 如图所示: -![42.接雨水5](https://file.kamacoder.com/pics/20210223094619398.png) +![42.接雨水5](https://file1.kamacoder.com/i/algo/20210223094619398.png) 4. 栈里要保存什么数值 @@ -284,7 +284,7 @@ if (height[i] == height[st.top()]) { // 例如 5 5 1 7 这种情况 如果当前遍历的元素(柱子)高度大于栈顶元素的高度,此时就出现凹槽了,如图所示: -![42.接雨水4](https://file.kamacoder.com/pics/2021022309321229-20230310123027977.png) +![42.接雨水4](https://file1.kamacoder.com/i/algo/2021022309321229-20230310123027977.png) 取栈顶元素,将栈顶元素弹出,这个就是凹槽的底部,也就是中间位置,下标记为mid,对应的高度为height[mid](就是图中的高度1)。 diff --git "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" old mode 100644 new mode 100755 index dd51384d77..c20cdc65e6 --- "a/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" +++ "b/problems/0045.\350\267\263\350\267\203\346\270\270\346\210\217II.md" @@ -47,7 +47,7 @@ 如图: -![45.跳跃游戏II](https://file.kamacoder.com/pics/20201201232309103.png) +![45.跳跃游戏II](https://file1.kamacoder.com/i/algo/20201201232309103.png) **图中覆盖范围的意义在于,只要红色的区域,最多两步一定可以到!(不用管具体怎么跳,反正一定可以跳到)** @@ -99,11 +99,11 @@ public: 因为当移动下标指向 nums.size - 2 时: - 如果移动下标等于当前覆盖最大距离下标, 需要再走一步(即 ans++),因为最后一步一定是可以到的终点。(题目假设总是可以到达数组的最后一个位置),如图: - ![45.跳跃游戏II2](https://file.kamacoder.com/pics/20201201232445286.png) + ![45.跳跃游戏II2](https://file1.kamacoder.com/i/algo/20201201232445286.png) - 如果移动下标不等于当前覆盖最大距离下标,说明当前覆盖最远距离就可以直接达到终点了,不需要再走一步。如图: -![45.跳跃游戏II1](https://file.kamacoder.com/pics/20201201232338693.png) +![45.跳跃游戏II1](https://file1.kamacoder.com/i/algo/20201201232338693.png) 代码如下: diff --git "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" old mode 100644 new mode 100755 index 5a190242e3..356f51b5a8 --- "a/problems/0046.\345\205\250\346\216\222\345\210\227.md" +++ "b/problems/0046.\345\205\250\346\216\222\345\210\227.md" @@ -41,7 +41,7 @@ 我以[1,2,3]为例,抽象成树形结构如下: -![全排列](https://file.kamacoder.com/pics/20240803180318.png) +![全排列](https://file1.kamacoder.com/i/algo/20240803180318.png) ### 回溯三部曲 @@ -53,7 +53,7 @@ 但排列问题需要一个used数组,标记已经选择的元素,如图橘黄色部分所示: -![全排列](https://file.kamacoder.com/pics/20240803180318.png) +![全排列](https://file1.kamacoder.com/i/algo/20240803180318.png) 代码如下: @@ -65,7 +65,7 @@ void backtracking (vector& nums, vector& used) * 递归终止条件 -![全排列](https://file.kamacoder.com/pics/20240803180318.png) +![全排列](https://file1.kamacoder.com/i/algo/20240803180318.png) 可以看出叶子节点,就是收割结果的地方。 diff --git "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" old mode 100644 new mode 100755 index 6ed794aaaf..5330997a66 --- "a/problems/0047.\345\205\250\346\216\222\345\210\227II.md" +++ "b/problems/0047.\345\205\250\346\216\222\345\210\227II.md" @@ -48,7 +48,7 @@ 我以示例中的 [1,1,2]为例 (为了方便举例,已经排序)抽象为一棵树,去重过程如图: -![47.全排列II1](https://file.kamacoder.com/pics/20201124201331223.png) +![47.全排列II1](https://file1.kamacoder.com/i/algo/20201124201331223.png) 图中我们对同一树层,前一位(也就是nums[i-1])如果使用过,那么就进行去重。 @@ -130,11 +130,11 @@ if (i > 0 && nums[i] == nums[i - 1] && used[i - 1] == true) { 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2](https://file.kamacoder.com/pics/20201124201406192.png) +![47.全排列II2](https://file1.kamacoder.com/i/algo/20201124201406192.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://file.kamacoder.com/pics/20201124201431571.png) +![47.全排列II3](https://file1.kamacoder.com/i/algo/20201124201431571.png) 大家应该很清晰的看到,树层上对前一位去重非常彻底,效率很高,树枝上对前一位去重虽然最后可以得到答案,但是做了很多无用搜索。 diff --git "a/problems/0051.N\347\232\207\345\220\216.md" "b/problems/0051.N\347\232\207\345\220\216.md" old mode 100644 new mode 100755 index 2a90a023e6..d06d7798e8 --- "a/problems/0051.N\347\232\207\345\220\216.md" +++ "b/problems/0051.N\347\232\207\345\220\216.md" @@ -15,7 +15,7 @@ n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上, 示例 1: -![](https://file.kamacoder.com/pics/20211020232201.png) +![](https://file1.kamacoder.com/i/algo/20211020232201.png) * 输入:n = 4 * 输出:[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]] @@ -45,7 +45,7 @@ n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上, 下面我用一个 3 * 3 的棋盘,将搜索过程抽象为一棵树,如图: -![51.N皇后](https://file.kamacoder.com/pics/20210130182532303.jpg) +![51.N皇后](https://file1.kamacoder.com/i/algo/20210130182532303.jpg) 从图中,可以看出,二维矩阵中矩阵的高就是这棵树的高度,矩阵的宽就是树形结构中每一个节点的宽度。 @@ -85,7 +85,7 @@ void backtracking(int n, int row, vector& chessboard) { * 递归终止条件 在如下树形结构中: -![51.N皇后](https://file.kamacoder.com/pics/20210130182532303-20230310122134167.jpg) +![51.N皇后](https://file1.kamacoder.com/i/algo/20210130182532303-20230310122134167.jpg) 可以看出,当递归到棋盘最底层(也就是叶子节点)的时候,就可以收集结果并返回了。 diff --git "a/problems/0052.N\347\232\207\345\220\216II.md" "b/problems/0052.N\347\232\207\345\220\216II.md" old mode 100644 new mode 100755 index 489ab1f756..6c6650ad00 --- "a/problems/0052.N\347\232\207\345\220\216II.md" +++ "b/problems/0052.N\347\232\207\345\220\216II.md" @@ -13,7 +13,7 @@ n 皇后问题研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并 上图为 8 皇后问题的一种解法。 -![51n皇后](https://file.kamacoder.com/pics/20200821152118456.png) +![51n皇后](https://file1.kamacoder.com/i/algo/20200821152118456.png) 给定一个整数 n,返回 n 皇后不同的解决方案的数量。 diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" old mode 100644 new mode 100755 index 6f8c2a6e7e..84bb5f6663 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214.md" @@ -76,7 +76,7 @@ if (count > result) result = count; 如动画所示: -![53.最大子序和](https://code-thinking.cdn.bcebos.com/gifs/53.%E6%9C%80%E5%A4%A7%E5%AD%90%E5%BA%8F%E5%92%8C.gif) +![53.最大子序和](https://file1.kamacoder.com/i/algo/53.%E6%9C%80%E5%A4%A7%E5%AD%90%E5%BA%8F%E5%92%8C.gif) 红色的起始位置就是贪心每次取 count 为正数的时候,开始一个区间的统计。 diff --git "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" old mode 100644 new mode 100755 index 174f55e848..ba44a36104 --- "a/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" +++ "b/problems/0053.\346\234\200\345\244\247\345\255\220\345\272\217\345\222\214\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" @@ -54,7 +54,7 @@ dp[0]应该是多少呢? 5. 举例推导dp数组 以示例一为例,输入:nums = [-2,1,-3,4,-1,2,1,-5,4],对应的dp状态如下: -![53.最大子序和(动态规划)](https://file.kamacoder.com/pics/20210303104129101.png) +![53.最大子序和(动态规划)](https://file1.kamacoder.com/i/algo/20210303104129101.png) **注意最后的结果可不是dp[nums.size() - 1]!** ,而是dp[6]。 diff --git "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" old mode 100644 new mode 100755 index a852b6740d..8b700c1fe8 --- "a/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" +++ "b/problems/0054.\350\236\272\346\227\213\347\237\251\351\230\265.md" @@ -36,7 +36,7 @@ 由外向内一圈一圈这么画下去,如下所示: -![](https://file.kamacoder.com/pics/20220922102236.png) +![](https://file1.kamacoder.com/i/algo/20220922102236.png) 这里每一种颜色,代表一条边,我们遍历的长度,可以看出每一个拐角处的处理规则,拐角处让给新的一条边来继续画。 diff --git "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" old mode 100644 new mode 100755 index 0ebbcb595c..513fc2e340 --- "a/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" +++ "b/problems/0055.\350\267\263\350\267\203\346\270\270\346\210\217.md" @@ -48,7 +48,7 @@ 如图: -![](https://file.kamacoder.com/pics/20230203105634.png) +![](https://file1.kamacoder.com/i/algo/20230203105634.png) i 每次移动只能在 cover 的范围内移动,每移动一个元素,cover 得到该元素数值(新的覆盖范围)的补充,让 i 继续移动下去。 diff --git "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" old mode 100644 new mode 100755 index cb06fcab3d..24a97f6c5a --- "a/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" +++ "b/problems/0056.\345\220\210\345\271\266\345\214\272\351\227\264.md" @@ -38,7 +38,7 @@ 这么说有点抽象,看图:(**注意图中区间都是按照左边界排序之后了**) -![56.合并区间](https://file.kamacoder.com/pics/20201223200632791.png) +![56.合并区间](https://file1.kamacoder.com/i/algo/20201223200632791.png) 知道如何判断重复之后,剩下的就是合并了,如何去模拟合并区间呢? diff --git "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" old mode 100644 new mode 100755 index d7aea257a5..927df1c6c1 --- "a/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" +++ "b/problems/0059.\350\236\272\346\227\213\347\237\251\351\230\265II.md" @@ -54,7 +54,7 @@ 那么我按照左闭右开的原则,来画一圈,大家看一下: -![](https://file.kamacoder.com/pics/20220922102236.png) +![](https://file1.kamacoder.com/i/algo/20220922102236.png) 这里每一种颜色,代表一条边,我们遍历的长度,可以看出每一个拐角处的处理规则,拐角处让给新的一条边来继续画。 diff --git "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" old mode 100644 new mode 100755 index 20bd56ba9f..ac60767dce --- "a/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" +++ "b/problems/0062.\344\270\215\345\220\214\350\267\257\345\276\204.md" @@ -16,7 +16,7 @@ 示例 1: -![](https://file.kamacoder.com/pics/20210110174033215.png) +![](https://file1.kamacoder.com/i/algo/20210110174033215.png) * 输入:m = 3, n = 7 * 输出:28 @@ -62,7 +62,7 @@ 如图举例: -![62.不同路径](https://file.kamacoder.com/pics/20201209113602700.png) +![62.不同路径](https://file1.kamacoder.com/i/algo/20201209113602700.png) 此时问题就可以转化为求二叉树叶子节点的个数,代码如下: @@ -131,7 +131,7 @@ for (int j = 0; j < n; j++) dp[0][j] = 1; 如图所示: -![62.不同路径1](https://file.kamacoder.com/pics/20201209113631392.png) +![62.不同路径1](https://file1.kamacoder.com/i/algo/20201209113631392.png) 以上动规五部曲分析完毕,C++代码如下: @@ -180,7 +180,7 @@ public: 在这个图中,可以看出一共m,n的话,无论怎么走,走到终点都需要 m + n - 2 步。 -![62.不同路径](https://file.kamacoder.com/pics/20201209113602700-20230310120944078.png) +![62.不同路径](https://file1.kamacoder.com/i/algo/20201209113602700-20230310120944078.png) 在这m + n - 2 步中,一定有 m - 1 步是要向下走的,不用管什么时候向下走。 @@ -190,7 +190,7 @@ public: 那么答案,如图所示: -![62.不同路径2](https://file.kamacoder.com/pics/20201209113725324.png) +![62.不同路径2](https://file1.kamacoder.com/i/algo/20201209113725324.png) **求组合的时候,要防止两个int相乘溢出!** 所以不能把算式的分子都算出来,分母都算出来再做除法。 diff --git "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" old mode 100644 new mode 100755 index d39036ba3a..f39afe8455 --- "a/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" +++ "b/problems/0063.\344\270\215\345\220\214\350\267\257\345\276\204II.md" @@ -14,13 +14,13 @@ 现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径? -![](https://file.kamacoder.com/pics/20210111204901338.png) +![](https://file1.kamacoder.com/i/algo/20210111204901338.png) 网格中的障碍物和空位置分别用 1 和 0 来表示。 示例 1: -![](https://file.kamacoder.com/pics/20210111204939971.png) +![](https://file1.kamacoder.com/i/algo/20210111204939971.png) * 输入:obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]] * 输出:2 @@ -32,7 +32,7 @@ 示例 2: -![](https://file.kamacoder.com/pics/20210111205857918.png) +![](https://file1.kamacoder.com/i/algo/20210111205857918.png) * 输入:obstacleGrid = [[0,1],[0,0]] * 输出:1 @@ -93,7 +93,7 @@ for (int j = 0; j < n; j++) dp[0][j] = 1; 如图: -![63.不同路径II](https://file.kamacoder.com/pics/20210104114513928.png) +![63.不同路径II](https://file1.kamacoder.com/i/algo/20210104114513928.png) 下标(0, j)的初始化情况同理。 @@ -127,11 +127,11 @@ for (int i = 1; i < m; i++) { 拿示例1来举例如题: -![63.不同路径II1](https://file.kamacoder.com/pics/20210104114548983.png) +![63.不同路径II1](https://file1.kamacoder.com/i/algo/20210104114548983.png) 对应的dp table 如图: -![63.不同路径II2](https://file.kamacoder.com/pics/20210104114610256.png) +![63.不同路径II2](https://file1.kamacoder.com/i/algo/20210104114610256.png) 如果这个图看不懂,建议再理解一下递归公式,然后照着文章中说的遍历顺序,自己推导一下! diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" old mode 100644 new mode 100755 index 17bf3ee760..316fbd4f39 --- "a/problems/0070.\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0070.\347\210\254\346\245\274\346\242\257.md" @@ -101,7 +101,7 @@ dp[i]: 爬到第i层楼梯,有dp[i]种方法 举例当n为5的时候,dp table(dp数组)应该是这样的 -![70.爬楼梯](https://file.kamacoder.com/pics/20210105202546299.png) +![70.爬楼梯](https://file1.kamacoder.com/i/algo/20210105202546299.png) 如果代码出问题了,就把dp table 打印出来,看看究竟是不是和自己推导的一样。 diff --git "a/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" "b/problems/0070.\347\210\254\346\245\274\346\242\257\345\256\214\345\205\250\350\203\214\345\214\205\347\211\210\346\234\254.md" old mode 100644 new mode 100755 diff --git "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" old mode 100644 new mode 100755 index 192ea47002..c4bcbb4338 --- "a/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" +++ "b/problems/0072.\347\274\226\350\276\221\350\267\235\347\246\273.md" @@ -170,7 +170,7 @@ for (int j = 0; j <= word2.size(); j++) dp[0][j] = j; 可以看出dp[i][j]是依赖左方,上方和左上方元素的,如图: -![72.编辑距离](https://file.kamacoder.com/pics/20210114162113131.jpg) +![72.编辑距离](https://file1.kamacoder.com/i/algo/20210114162113131.jpg) 所以在dp矩阵中一定是从左到右从上到下去遍历。 @@ -194,7 +194,7 @@ for (int i = 1; i <= word1.size(); i++) { 以示例1为例,输入:`word1 = "horse", word2 = "ros"`为例,dp矩阵状态图如下: -![72.编辑距离1](https://file.kamacoder.com/pics/20210114162132300.jpg) +![72.编辑距离1](https://file1.kamacoder.com/i/algo/20210114162132300.jpg) 以上动规五部分析完毕,C++代码如下: diff --git "a/problems/0077.\347\273\204\345\220\210.md" "b/problems/0077.\347\273\204\345\220\210.md" old mode 100644 new mode 100755 index c523c01c17..4c9e97fd47 --- "a/problems/0077.\347\273\204\345\220\210.md" +++ "b/problems/0077.\347\273\204\345\220\210.md" @@ -82,7 +82,7 @@ for (int i = 1; i <= n; i++) { 那么我把组合问题抽象为如下树形结构: -![77.组合](https://file.kamacoder.com/pics/20201123195223940.png) +![77.组合](https://file1.kamacoder.com/i/algo/20201123195223940.png) 可以看出这棵树,一开始集合是 1,2,3,4, 从左向右取数,取过的数,不再重复取。 @@ -126,7 +126,7 @@ vector path; // 用来存放符合条件结果 从下图中红线部分可以看出,在集合[1,2,3,4]取1之后,下一层递归,就要在[2,3,4]中取数了,那么下一层递归如何知道从[2,3,4]中取数呢,靠的就是startIndex。 -![77.组合2](https://file.kamacoder.com/pics/20201123195328976.png) +![77.组合2](https://file1.kamacoder.com/i/algo/20201123195328976.png) 所以需要startIndex来记录下一层递归,搜索的起始位置。 @@ -146,7 +146,7 @@ path这个数组的大小如果达到k,说明我们找到了一个子集大小 如图红色部分: -![77.组合3](https://file.kamacoder.com/pics/20201123195407907.png) +![77.组合3](https://file1.kamacoder.com/i/algo/20201123195407907.png) 此时用result二维数组,把path保存起来,并终止本层递归。 @@ -163,7 +163,7 @@ if (path.size() == k) { 回溯法的搜索过程就是一个树型结构的遍历过程,在如下图中,可以看出for循环用来横向遍历,递归的过程是纵向遍历。 -![77.组合1](https://file.kamacoder.com/pics/20201123195242899.png) +![77.组合1](https://file1.kamacoder.com/i/algo/20201123195242899.png) 如此我们才遍历完图中的这棵树。 @@ -267,7 +267,7 @@ for (int i = startIndex; i <= n; i++) { 这么说有点抽象,如图所示: -![77.组合4](https://file.kamacoder.com/pics/20210130194335207-20230310134409532.png) +![77.组合4](https://file1.kamacoder.com/i/algo/20210130194335207-20230310134409532.png) 图中每一个节点(图中为矩形),就代表本层的一个for循环,那么每一层的for循环从第二个数开始遍历的话,都没有意义,都是无效遍历。 diff --git "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" old mode 100644 new mode 100755 index c5e26e7706..8ddc4058cc --- "a/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" +++ "b/problems/0077.\347\273\204\345\220\210\344\274\230\345\214\226.md" @@ -67,7 +67,7 @@ for (int i = startIndex; i <= n; i++) { 这么说有点抽象,如图所示: -![77.组合4](https://file.kamacoder.com/pics/20210130194335207.png) +![77.组合4](https://file1.kamacoder.com/i/algo/20210130194335207.png) 图中每一个节点(图中为矩形),就代表本层的一个for循环,那么每一层的for循环从第二个数开始遍历的话,都没有意义,都是无效遍历。 diff --git "a/problems/0078.\345\255\220\351\233\206.md" "b/problems/0078.\345\255\220\351\233\206.md" old mode 100644 new mode 100755 index 73eb385bc1..844b8dc2ca --- "a/problems/0078.\345\255\220\351\233\206.md" +++ "b/problems/0078.\345\255\220\351\233\206.md" @@ -46,7 +46,7 @@ 以示例中nums = [1,2,3]为例把求子集抽象为树型结构,如下: -![78.子集](https://code-thinking.cdn.bcebos.com/pics/78.%E5%AD%90%E9%9B%86.png) +![78.子集](https://file1.kamacoder.com/i/algo/78.%E5%AD%90%E9%9B%86.png) 从图中红线部分,可以看出**遍历这个树的时候,把所有节点都记录下来,就是要求的子集集合**。 @@ -70,7 +70,7 @@ void backtracking(vector& nums, int startIndex) { 从图中可以看出: -![78.子集](https://code-thinking.cdn.bcebos.com/pics/78.%E5%AD%90%E9%9B%86.png) +![78.子集](https://file1.kamacoder.com/i/algo/78.%E5%AD%90%E9%9B%86.png) 剩余集合为空的时候,就是叶子节点。 diff --git "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" old mode 100644 new mode 100755 index e1a6671e73..99fb1678e6 --- "a/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" +++ "b/problems/0084.\346\237\261\347\212\266\345\233\276\344\270\255\346\234\200\345\244\247\347\232\204\347\237\251\345\275\242.md" @@ -11,9 +11,9 @@ 求在该柱状图中,能够勾勒出来的矩形的最大面积。 -![](https://file.kamacoder.com/pics/20210803220437.png) +![](https://file1.kamacoder.com/i/algo/20210803220437.png) -![](https://file.kamacoder.com/pics/20210803220506.png) +![](https://file1.kamacoder.com/i/algo/20210803220506.png) * 1 <= heights.length <=10^5 * 0 <= heights[i] <= 10^4 @@ -114,7 +114,7 @@ public: 我来举一个例子,如图: -![](https://file.kamacoder.com/pics/20230221165730.png) +![](https://file1.kamacoder.com/i/algo/20230221165730.png) 只有栈里从大到小的顺序,才能保证栈顶元素找到左右两边第一个小于栈顶元素的柱子。 @@ -179,7 +179,7 @@ public: 如果数组本身就是升序的,例如[2,4,6,8],那么入栈之后 都是单调递减,一直都没有走 情况三 计算结果的哪一步,所以最后输出的就是0了。 如图: -![](https://file.kamacoder.com/pics/20230221163936.png) +![](https://file1.kamacoder.com/i/algo/20230221163936.png) 那么结尾加一个0,就会让栈里的所有元素,走到情况三的逻辑。 @@ -194,7 +194,7 @@ public: 之后又将6 加入栈(此时8已经弹出了),然后 就是 4 与 栈口元素 6 进行比较,周而复始,那么计算的最后结果result就是0。 如图所示: -![](https://file.kamacoder.com/pics/20230221164533.png) +![](https://file1.kamacoder.com/i/algo/20230221164533.png) 所以我们需要在 height数组前后各加一个元素0。 diff --git "a/problems/0090.\345\255\220\351\233\206II.md" "b/problems/0090.\345\255\220\351\233\206II.md" old mode 100644 new mode 100755 index 2f26e6068f..2e8945c90f --- "a/problems/0090.\345\255\220\351\233\206II.md" +++ "b/problems/0090.\345\255\220\351\233\206II.md" @@ -39,7 +39,7 @@ 用示例中的[1, 2, 2] 来举例,如图所示: (**注意去重需要先对集合排序**) -![90.子集II](https://file.kamacoder.com/pics/20201124195411977.png) +![90.子集II](https://file1.kamacoder.com/i/algo/20201124195411977.png) 从图中可以看出,同一树层上重复取2 就要过滤掉,同一树枝上就可以重复取2,因为同一树枝上元素的集合才是唯一子集! diff --git "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" old mode 100644 new mode 100755 index 5ef2162898..6fa732d0c1 --- "a/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" +++ "b/problems/0093.\345\244\215\345\216\237IP\345\234\260\345\235\200.md" @@ -54,7 +54,7 @@ 切割问题可以抽象为树型结构,如图: -![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933.png) +![93.复原IP地址](https://file1.kamacoder.com/i/algo/20201123203735933.png) ### 回溯三部曲 @@ -106,7 +106,7 @@ if (pointNum == 3) { // 逗点数量为3时,分隔结束 如果不合法就结束本层循环,如图中剪掉的分支: -![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933-20230310132314109.png) +![93.复原IP地址](https://file1.kamacoder.com/i/algo/20201123203735933-20230310132314109.png) 然后就是递归和回溯的过程: diff --git "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" old mode 100644 new mode 100755 index ca99a46695..e5bc2b6b65 --- "a/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0096.\344\270\215\345\220\214\347\232\204\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -12,7 +12,7 @@ 示例: -![](https://file.kamacoder.com/pics/20210113161941835.png) +![](https://file1.kamacoder.com/i/algo/20210113161941835.png) ## 算法公开课 @@ -27,11 +27,11 @@ 了解了二叉搜索树之后,我们应该先举几个例子,画画图,看看有没有什么规律,如图: -![96.不同的二叉搜索树](https://file.kamacoder.com/pics/20210107093106367.png) +![96.不同的二叉搜索树](https://file1.kamacoder.com/i/algo/20210107093106367.png) n为1的时候有一棵树,n为2有两棵树,这个是很直观的。 -![96.不同的二叉搜索树1](https://file.kamacoder.com/pics/20210107093129889.png) +![96.不同的二叉搜索树1](https://file1.kamacoder.com/i/algo/20210107093129889.png) 来看看n为3的时候,有哪几种情况。 @@ -65,7 +65,7 @@ dp[3],就是 元素1为头结点搜索树的数量 + 元素2为头结点搜索 如图所示: -![96.不同的二叉搜索树2](https://file.kamacoder.com/pics/20210107093226241.png) +![96.不同的二叉搜索树2](https://file1.kamacoder.com/i/algo/20210107093226241.png) 此时我们已经找到递推关系了,那么可以用动规五部曲再系统分析一遍。 @@ -118,7 +118,7 @@ for (int i = 1; i <= n; i++) { n为5时候的dp数组状态如图: -![96.不同的二叉搜索树3](https://file.kamacoder.com/pics/20210107093253987.png) +![96.不同的二叉搜索树3](https://file1.kamacoder.com/i/algo/20210107093253987.png) 当然如果自己画图举例的话,基本举例到n为3就可以了,n为4的时候,画图已经比较麻烦了。 diff --git "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" old mode 100644 new mode 100755 index 9569cbddf1..990d3c8413 --- "a/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0098.\351\252\214\350\257\201\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -16,7 +16,7 @@ * 节点的右子树只包含大于当前节点的数。 * 所有左子树和右子树自身必须也是二叉搜索树。 -![98.验证二叉搜索树](https://file.kamacoder.com/pics/20230310000750.png) +![98.验证二叉搜索树](https://file1.kamacoder.com/i/algo/20230310000750.png) ## 算法公开课 @@ -102,7 +102,7 @@ if (root->val > root->left->val && root->val < root->right->val) { 例如: [10,5,15,null,null,6,20] 这个case: -![二叉搜索树](https://file.kamacoder.com/pics/20230310000824.png) +![二叉搜索树](https://file1.kamacoder.com/i/algo/20230310000824.png) 节点10大于左节点5,小于右节点15,但右子树里出现了一个6 这就不符合了! diff --git "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" old mode 100644 new mode 100755 index e5f610009e..df1b55a462 --- "a/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" +++ "b/problems/0100.\347\233\270\345\220\214\347\232\204\346\240\221.md" @@ -12,9 +12,9 @@ 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 -![](https://file.kamacoder.com/pics/20210726172932.png) +![](https://file1.kamacoder.com/i/algo/20210726172932.png) -![](https://file.kamacoder.com/pics/20210726173011.png) +![](https://file1.kamacoder.com/i/algo/20210726173011.png) ## 思路 diff --git "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index 205597b068..24e9e2684e --- "a/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0101.\345\257\271\347\247\260\344\272\214\345\217\211\346\240\221.md" @@ -9,7 +9,7 @@ 给定一个二叉树,检查它是否是镜像对称的。 -![101. 对称二叉树](https://file.kamacoder.com/pics/20210203144607387.png) +![101. 对称二叉树](https://file1.kamacoder.com/i/algo/20210203144607387.png) ## 算法公开课 @@ -25,7 +25,7 @@ 比较的是两个子树的里侧和外侧的元素是否相等。如图所示: -![101. 对称二叉树1](https://file.kamacoder.com/pics/20210203144624414.png) +![101. 对称二叉树1](https://file1.kamacoder.com/i/algo/20210203144624414.png) 那么遍历的顺序应该是什么样的呢? @@ -169,7 +169,7 @@ public: 通过队列来判断根节点的左子树和右子树的内侧和外侧是否相等,如动画所示: -![101.对称二叉树](https://code-thinking.cdn.bcebos.com/gifs/101.%E5%AF%B9%E7%A7%B0%E4%BA%8C%E5%8F%89%E6%A0%91.gif) +![101.对称二叉树](https://file1.kamacoder.com/i/algo/101.%E5%AF%B9%E7%A7%B0%E4%BA%8C%E5%8F%89%E6%A0%91.gif) diff --git "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" old mode 100644 new mode 100755 index 6725d72cc2..819153be97 --- "a/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" +++ "b/problems/0102.\344\272\214\345\217\211\346\240\221\347\232\204\345\261\202\345\272\217\351\201\215\345\216\206.md" @@ -26,7 +26,7 @@ -![我要打十个](https://code-thinking.cdn.bcebos.com/gifs/%E6%88%91%E8%A6%81%E6%89%93%E5%8D%81%E4%B8%AA.gif) +![我要打十个](https://file1.kamacoder.com/i/algo/%E6%88%91%E8%A6%81%E6%89%93%E5%8D%81%E4%B8%AA.gif) @@ -37,7 +37,7 @@ 给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 -![102.二叉树的层序遍历](https://file.kamacoder.com/pics/20210203144842988.png) +![102.二叉树的层序遍历](https://file1.kamacoder.com/i/algo/20210203144842988.png) ### 思路 @@ -57,7 +57,7 @@ 使用队列实现二叉树广度优先遍历,动画如下: -![102二叉树的层序遍历](https://code-thinking.cdn.bcebos.com/gifs/102%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E5%B1%82%E5%BA%8F%E9%81%8D%E5%8E%86.gif) +![102二叉树的层序遍历](https://file1.kamacoder.com/i/algo/102%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E5%B1%82%E5%BA%8F%E9%81%8D%E5%8E%86.gif) 这样就实现了层序从左到右遍历二叉树。 @@ -532,7 +532,7 @@ public IList> LevelOrder(TreeNode root) 给定一个二叉树,返回其节点值自底向上的层次遍历。 (即按从叶子节点所在层到根节点所在的层,逐层从左向右遍历) -![107.二叉树的层次遍历II](https://file.kamacoder.com/pics/20210203151058308.png) +![107.二叉树的层次遍历II](https://file1.kamacoder.com/i/algo/20210203151058308.png) ### 思路 @@ -926,7 +926,7 @@ public IList> LevelOrderBottom(TreeNode root) 给定一棵二叉树,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。 -![199.二叉树的右视图](https://file.kamacoder.com/pics/20210203151307377.png) +![199.二叉树的右视图](https://file1.kamacoder.com/i/algo/20210203151307377.png) ### 思路 @@ -1276,7 +1276,7 @@ public class Solution 给定一个非空二叉树, 返回一个由每层节点平均值组成的数组。 -![637.二叉树的层平均值](https://file.kamacoder.com/pics/20210203151350500.png) +![637.二叉树的层平均值](https://file1.kamacoder.com/i/algo/20210203151350500.png) ### 思路 @@ -1634,7 +1634,7 @@ public class Solution { 例如,给定一个 3叉树 : -![429. N叉树的层序遍历](https://file.kamacoder.com/pics/20210203151439168.png) +![429. N叉树的层序遍历](https://file1.kamacoder.com/i/algo/20210203151439168.png) 返回其层序遍历: @@ -2006,7 +2006,7 @@ impl Solution { 您需要在二叉树的每一行中找到最大的值。 -![515.在每个树行中找最大值](https://file.kamacoder.com/pics/20210203151532153.png) +![515.在每个树行中找最大值](https://file1.kamacoder.com/i/algo/20210203151532153.png) ### 思路 @@ -2337,7 +2337,7 @@ struct Node { 初始状态下,所有 next 指针都被设置为 NULL。 -![116.填充每个节点的下一个右侧节点指针](https://file.kamacoder.com/pics/20210203152044855.jpg) +![116.填充每个节点的下一个右侧节点指针](https://file1.kamacoder.com/i/algo/20210203152044855.jpg) ### 思路 @@ -2971,7 +2971,7 @@ object Solution { 给定二叉树 [3,9,20,null,null,15,7], -![104. 二叉树的最大深度](https://file.kamacoder.com/pics/20210203153031914-20230310134849764.png) +![104. 二叉树的最大深度](https://file1.kamacoder.com/i/algo/20210203153031914-20230310134849764.png) 返回它的最大深度 3 。 @@ -2981,7 +2981,7 @@ object Solution { 在二叉树中,一层一层的来遍历二叉树,记录一下遍历的层数就是二叉树的深度,如图所示: -![层序遍历](https://file.kamacoder.com/pics/20200810193056585-20230310134854803.png) +![层序遍历](https://file1.kamacoder.com/i/algo/20200810193056585-20230310134854803.png) 所以这道题的迭代法就是一道模板题,可以使用二叉树层序遍历的模板来解决的。 diff --git "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" old mode 100644 new mode 100755 index 2eb22ae5a3..52d6d0e5fd --- "a/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" +++ "b/problems/0104.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\244\247\346\267\261\345\272\246.md" @@ -18,7 +18,7 @@ 给定二叉树 [3,9,20,null,null,15,7], -![104. 二叉树的最大深度](https://file.kamacoder.com/pics/20210203153031914-20230310121809902.png) +![104. 二叉树的最大深度](https://file1.kamacoder.com/i/algo/20210203153031914-20230310121809902.png) 返回它的最大深度 3 。 @@ -172,7 +172,7 @@ public: 在二叉树中,一层一层的来遍历二叉树,记录一下遍历的层数就是二叉树的深度,如图所示: -![层序遍历](https://file.kamacoder.com/pics/20200810193056585.png) +![层序遍历](https://file1.kamacoder.com/i/algo/20200810193056585.png) 所以这道题的迭代法就是一道模板题,可以使用二叉树层序遍历的模板来解决的。 @@ -217,7 +217,7 @@ public: 例如,给定一个 3叉树 : -![559.n叉树的最大深度](https://file.kamacoder.com/pics/2021020315313214.png) +![559.n叉树的最大深度](https://file1.kamacoder.com/i/algo/2021020315313214.png) 我们应返回其最大深度,3。 diff --git "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index 2f8e5eefb6..5253325835 --- "a/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0106.\344\273\216\344\270\255\345\272\217\344\270\216\345\220\216\345\272\217\351\201\215\345\216\206\345\272\217\345\210\227\346\236\204\351\200\240\344\272\214\345\217\211\346\240\221.md" @@ -25,7 +25,7 @@ * 后序遍历 postorder = [9,15,7,20,3] 返回如下的二叉树: -![106. 从中序与后序遍历序列构造二叉树1](https://file.kamacoder.com/pics/20210203154316774.png) +![106. 从中序与后序遍历序列构造二叉树1](https://file1.kamacoder.com/i/algo/20210203154316774.png) ## 算法公开课 @@ -40,7 +40,7 @@ 流程如图: -![106.从中序与后序遍历序列构造二叉树](https://file.kamacoder.com/pics/20210203154249860.png) +![106.从中序与后序遍历序列构造二叉树](https://file1.kamacoder.com/i/algo/20210203154249860.png) 那么代码应该怎么写呢? @@ -411,7 +411,7 @@ public: 中序遍历 inorder = [9,3,15,20,7] 返回如下的二叉树: -![105. 从前序与中序遍历序列构造二叉树](https://file.kamacoder.com/pics/20210203154626672.png) +![105. 从前序与中序遍历序列构造二叉树](https://file1.kamacoder.com/i/algo/20210203154626672.png) ### 思路 @@ -554,7 +554,7 @@ public: 举一个例子: -![106.从中序与后序遍历序列构造二叉树2](https://file.kamacoder.com/pics/20210203154720326.png) +![106.从中序与后序遍历序列构造二叉树2](https://file1.kamacoder.com/i/algo/20210203154720326.png) tree1 的前序遍历是[1 2 3], 后序遍历是[3 2 1]。 diff --git "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" old mode 100644 new mode 100755 index 5829e2d220..2df1c2615b --- "a/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0108.\345\260\206\346\234\211\345\272\217\346\225\260\347\273\204\350\275\254\346\215\242\344\270\272\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -16,7 +16,7 @@ 示例: -![108.将有序数组转换为二叉搜索树](https://file.kamacoder.com/pics/20201022164420763.png) +![108.将有序数组转换为二叉搜索树](https://file1.kamacoder.com/i/algo/20201022164420763.png) ## 算法公开课 @@ -40,7 +40,7 @@ 例如 有序数组[-10,-3,0,5,9] 就可以构造成这样的二叉搜索树,如图。 -![](https://file.kamacoder.com/pics/20220930173553.png) +![](https://file1.kamacoder.com/i/algo/20220930173553.png) 上图中,是符合二叉搜索树的特性吧,如果要这么做的话,是不是本题意义就不大了,所以才强调是平衡二叉搜索树。 @@ -63,7 +63,7 @@ 如下两棵树,都是这个数组的平衡二叉搜索树: -![108.将有序数组转换为二叉搜索树](https://code-thinking.cdn.bcebos.com/pics/108.将有序数组转换为二叉搜索树.png) +![108.将有序数组转换为二叉搜索树](https://file1.kamacoder.com/i/algo/108.将有序数组转换为二叉搜索树.png) 如果要分割的数组长度为偶数的时候,中间元素为两个,是取左边元素 就是树1,取右边元素就是树2。 diff --git "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index ff84ad8471..d5b100ae80 --- "a/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0110.\345\271\263\350\241\241\344\272\214\345\217\211\346\240\221.md" @@ -19,7 +19,7 @@ 给定二叉树 [3,9,20,null,null,15,7] -![110.平衡二叉树](https://file.kamacoder.com/pics/2021020315542230.png) +![110.平衡二叉树](https://file1.kamacoder.com/i/algo/2021020315542230.png) 返回 true 。 @@ -27,7 +27,7 @@ 给定二叉树 [1,2,2,3,3,null,null,4,4] -![110.平衡二叉树1](https://file.kamacoder.com/pics/20210203155447919.png) +![110.平衡二叉树1](https://file1.kamacoder.com/i/algo/20210203155447919.png) 返回 false 。 @@ -46,7 +46,7 @@ 但leetcode中强调的深度和高度很明显是按照节点来计算的,如图: -![110.平衡二叉树2](https://file.kamacoder.com/pics/20210203155515650.png) +![110.平衡二叉树2](https://file1.kamacoder.com/i/algo/20210203155515650.png) 关于根节点的深度究竟是1 还是 0,不同的地方有不一样的标准,leetcode的题目中都是以节点为一度,即根节点深度是1。但维基百科上定义用边为一度,即根节点的深度是0,我们暂时以leetcode为准(毕竟要在这上面刷题)。 diff --git "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" old mode 100644 new mode 100755 index bd4ea29d6c..e1ee42657c --- "a/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" +++ "b/problems/0111.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\345\260\217\346\267\261\345\272\246.md" @@ -20,7 +20,7 @@ 给定二叉树 [3,9,20,null,null,15,7], -![111.二叉树的最小深度1](https://file.kamacoder.com/pics/2021020315582586.png) +![111.二叉树的最小深度1](https://file1.kamacoder.com/i/algo/2021020315582586.png) 返回它的最小深度 2. @@ -46,7 +46,7 @@ 本题还有一个误区,在处理节点的过程中,最大深度很容易理解,最小深度就不那么好理解,如图: -![111.二叉树的最小深度](https://code-thinking.cdn.bcebos.com/pics/111.%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E6%B7%B1%E5%BA%A6.png) +![111.二叉树的最小深度](https://file1.kamacoder.com/i/algo/111.%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E6%B7%B1%E5%BA%A6.png) 这就重新审题了,题目中说的是:**最小深度是从根节点到最近叶子节点的最短路径上的节点数量。**注意是**叶子节点**。 @@ -88,7 +88,7 @@ return result; 这个代码就犯了此图中的误区: -![111.二叉树的最小深度](https://code-thinking.cdn.bcebos.com/pics/111.%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E6%B7%B1%E5%BA%A6.png) +![111.二叉树的最小深度](https://file1.kamacoder.com/i/algo/111.%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E6%B7%B1%E5%BA%A6.png) 如果这么求的话,没有左孩子的分支会算为最短深度。 diff --git "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" old mode 100644 new mode 100755 index 24891acee9..73795bcfc9 --- "a/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" +++ "b/problems/0112.\350\267\257\345\276\204\346\200\273\345\222\214.md" @@ -15,7 +15,7 @@ 示例: 给定如下二叉树,以及目标和 sum = 22, -![](https://file.kamacoder.com/pics/20230407210247.png) +![](https://file1.kamacoder.com/i/algo/20230407210247.png) 返回 true, 因为存在目标和为 22 的根节点到叶子节点的路径 5->4->11->2。 @@ -53,7 +53,7 @@ 如图所示: -![112.路径总和](https://file.kamacoder.com/pics/2021020316051216.png) +![112.路径总和](https://file1.kamacoder.com/i/algo/2021020316051216.png) 图中可以看出,遍历的路线,并不要遍历整棵树,所以递归函数需要返回值,可以用bool类型表示。 @@ -230,7 +230,7 @@ public: 给定如下二叉树,以及目标和 sum = 22, -![113.路径总和ii1.png](https://file.kamacoder.com/pics/20210203160854654.png) +![113.路径总和ii1.png](https://file1.kamacoder.com/i/algo/20210203160854654.png) ### 思路 @@ -239,7 +239,7 @@ public: 如图: -![113.路径总和ii](https://file.kamacoder.com/pics/20210203160922745.png) +![113.路径总和ii](https://file1.kamacoder.com/i/algo/20210203160922745.png) 为了尽可能的把细节体现出来,我写出如下代码(**这份代码并不简洁,但是逻辑非常清晰**) diff --git "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index 1df3d899a8..499bf100e2 --- "a/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0115.\344\270\215\345\220\214\347\232\204\345\255\220\345\272\217\345\210\227.md" @@ -12,7 +12,7 @@ 题目数据保证答案符合 32 位带符号整数范围。 -![115.不同的子序列示例](https://code-thinking.cdn.bcebos.com/pics/115.不同的子序列示例.jpg) +![115.不同的子序列示例](https://file1.kamacoder.com/i/algo/115.不同的子序列示例.jpg) 提示: @@ -70,7 +70,7 @@ dp[i][j]:以i-1为结尾的s子序列中出现以j-1为结尾的t的个数为d 从递推公式dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]; 和 dp[i][j] = dp[i - 1][j]; 中可以看出dp[i][j] 是从上方和左上方推导而来,如图:,那么 dp[i][0] 和dp[0][j]是一定要初始化的。 -![](https://file.kamacoder.com/pics/20221222165412.png) +![](https://file1.kamacoder.com/i/algo/20221222165412.png) 每次当初始化的时候,都要回顾一下dp[i][j]的定义,不要凭感觉初始化。 @@ -101,7 +101,7 @@ for (int j = 1; j <= t.size(); j++) dp[0][j] = 0; // 其实这行代码可以和 从递推公式dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]; 和 dp[i][j] = dp[i - 1][j]; 中可以看出dp[i][j]都是根据左上方和正上方推出来的。 -![](https://file.kamacoder.com/pics/20221222165412.png) +![](https://file1.kamacoder.com/i/algo/20221222165412.png) 所以遍历的时候一定是从上到下,从左到右,这样保证dp[i][j]可以根据之前计算出来的数值进行计算。 @@ -123,7 +123,7 @@ for (int i = 1; i <= s.size(); i++) { 以s:"baegg",t:"bag"为例,推导dp数组状态如下: -![115.不同的子序列](https://code-thinking.cdn.bcebos.com/pics/115.%E4%B8%8D%E5%90%8C%E7%9A%84%E5%AD%90%E5%BA%8F%E5%88%97.jpg) +![115.不同的子序列](https://file1.kamacoder.com/i/algo/115.%E4%B8%8D%E5%90%8C%E7%9A%84%E5%AD%90%E5%BA%8F%E5%88%97.jpg) 如果写出来的代码怎么改都通过不了,不妨把dp数组打印出来,看一看,是不是这样的。 diff --git "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" old mode 100644 new mode 100755 index 9de1de1ee5..88d3abc93e --- "a/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" +++ "b/problems/0116.\345\241\253\345\205\205\346\257\217\344\270\252\350\212\202\347\202\271\347\232\204\344\270\213\344\270\200\344\270\252\345\217\263\344\276\247\350\212\202\347\202\271\346\214\207\351\222\210.md" @@ -26,7 +26,7 @@ struct Node { * 你只能使用常量级额外空间。 * 使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空间复杂度。 -![](https://file.kamacoder.com/pics/20210727143202.png) +![](https://file1.kamacoder.com/i/algo/20210727143202.png) ## 思路 @@ -42,7 +42,7 @@ struct Node { 如图,假如当前操作的节点是cur: - + 最关键的点是可以通过上一层递归 搭出来的线,进行本次搭线。 diff --git "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" old mode 100644 new mode 100755 index f82ed962fa..d12cbf2fe2 --- "a/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" +++ "b/problems/0121.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272.md" @@ -129,7 +129,7 @@ dp[0][1]表示第0天不持有股票,不持有股票那么现金就是0,所 以示例1,输入:[7,1,5,3,6,4]为例,dp数组状态如下: -![121.买卖股票的最佳时机](https://file.kamacoder.com/pics/20210224225642465.png) +![121.买卖股票的最佳时机](https://file1.kamacoder.com/i/algo/20210224225642465.png) dp[5][1]就是最终结果。 diff --git "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" old mode 100644 new mode 100755 index 4ccb17bbfd..0da4241931 --- "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" +++ "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II.md" @@ -66,7 +66,7 @@ 如图: -![122.买卖股票的最佳时机II](https://file.kamacoder.com/pics/2020112917480858-20230310134659477.png) +![122.买卖股票的最佳时机II](https://file1.kamacoder.com/i/algo/2020112917480858-20230310134659477.png) 一些同学陷入:第一天怎么就没有利润呢,第一天到底算不算的困惑中。 diff --git "a/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0122.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272II\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" old mode 100644 new mode 100755 diff --git "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" old mode 100644 new mode 100755 index c4ff89a0c5..063477cb5a --- "a/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" +++ "b/problems/0123.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272III.md" @@ -120,7 +120,7 @@ dp[i][4] = max(dp[i - 1][4], dp[i - 1][3] + prices[i]); 以输入[1,2,3,4,5]为例 -![123.买卖股票的最佳时机III](https://file.kamacoder.com/pics/20201228181724295-20230310134201291.png) +![123.买卖股票的最佳时机III](https://file1.kamacoder.com/i/algo/20201228181724295-20230310134201291.png) 大家可以看到红色框为最后两次卖出的状态。 diff --git "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" old mode 100644 new mode 100755 index 1ce0bc11a7..0204606056 --- "a/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" +++ "b/problems/0127.\345\215\225\350\257\215\346\216\245\351\276\231.md" @@ -31,7 +31,7 @@ 以示例1为例,从这个图中可以看出 hit 到 cog的路线,不止一条,有三条,一条是最短的长度为5,两条长度为6。 -![](https://file.kamacoder.com/pics/20210827175432.png) +![](https://file1.kamacoder.com/i/algo/20210827175432.png) 本题只需要求出最短路径的长度就可以了,不用找出路径。 diff --git "a/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" "b/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" old mode 100644 new mode 100755 index 923bc63807..1568a49469 --- "a/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" +++ "b/problems/0129.\346\261\202\346\240\271\345\210\260\345\217\266\345\255\220\350\212\202\347\202\271\346\225\260\345\255\227\344\271\213\345\222\214.md" @@ -81,7 +81,7 @@ int vectorToInt(const vector& vec) { 如图: - + 代码如下: diff --git "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" old mode 100644 new mode 100755 index 278c12eccc..10d6585c4c --- "a/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" +++ "b/problems/0130.\350\242\253\345\233\264\347\273\225\347\232\204\345\214\272\345\237\237.md" @@ -8,7 +8,7 @@ 给你一个 m x n 的矩阵 board ,由若干字符 'X' 和 'O' ,找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。 -![](https://file.kamacoder.com/pics/20220901104745.png) +![](https://file1.kamacoder.com/i/algo/20220901104745.png) * 输入:board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]] * 输出:[["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O","X","X"]] @@ -28,11 +28,11 @@ 步骤一:深搜或者广搜将地图周边的'O'全部改成'A',如图所示: -![图一](https://file.kamacoder.com/pics/20220902102337.png) +![图一](https://file1.kamacoder.com/i/algo/20220902102337.png) 步骤二:在遍历地图,将'O'全部改成'X'(地图中间的'O'改成了'X'),将'A'改回'O'(保留的地图周边的'O'),如图所示: -![图二](https://file.kamacoder.com/pics/20220902102831.png) +![图二](https://file1.kamacoder.com/i/algo/20220902102831.png) 整体C++代码如下,以下使用dfs实现,其实遍历方式dfs,bfs都是可以的。 diff --git "a/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" "b/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" old mode 100644 new mode 100755 index f9b5d244c5..c76f1ce2f1 --- "a/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" +++ "b/problems/0131.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262.md" @@ -50,7 +50,7 @@ 所以切割问题,也可以抽象为一棵树形结构,如图: -![131.分割回文串](https://code-thinking.cdn.bcebos.com/pics/131.%E5%88%86%E5%89%B2%E5%9B%9E%E6%96%87%E4%B8%B2.jpg) +![131.分割回文串](https://file1.kamacoder.com/i/algo/131.%E5%88%86%E5%89%B2%E5%9B%9E%E6%96%87%E4%B8%B2.jpg) 递归用来纵向遍历,for循环用来横向遍历,切割线(就是图中的红线)切割到字符串的结尾位置,说明找到了一个切割方法。 @@ -76,7 +76,7 @@ void backtracking (const string& s, int startIndex) { * 递归函数终止条件 -![131.分割回文串](https://code-thinking.cdn.bcebos.com/pics/131.%E5%88%86%E5%89%B2%E5%9B%9E%E6%96%87%E4%B8%B2.jpg) +![131.分割回文串](https://file1.kamacoder.com/i/algo/131.%E5%88%86%E5%89%B2%E5%9B%9E%E6%96%87%E4%B8%B2.jpg) 从树形结构的图中可以看出:切割线切到了字符串最后面,说明找到了一种切割方法,此时就是本层递归的终止条件。 diff --git "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" old mode 100644 new mode 100755 index 089dd52c78..8bbfa4ee10 --- "a/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" +++ "b/problems/0132.\345\210\206\345\211\262\345\233\236\346\226\207\344\270\262II.md" @@ -161,7 +161,7 @@ for (int i = s.size() - 1; i >= 0; i--) { 以输入:"aabc" 为例: -![132.分割回文串II](https://file.kamacoder.com/pics/20210124182218844.jpg) +![132.分割回文串II](https://file1.kamacoder.com/i/algo/20210124182218844.jpg) 以上分析完毕,代码如下: diff --git "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" old mode 100644 new mode 100755 index 354f642448..5c8b0c3cc8 --- "a/problems/0134.\345\212\240\346\262\271\347\253\231.md" +++ "b/problems/0134.\345\212\240\346\262\271\347\253\231.md" @@ -144,7 +144,7 @@ i从0开始累加rest[i],和记为curSum,一旦curSum小于零,说明[0, i 如图: -![](https://file.kamacoder.com/pics/20230117165628.png) +![](https://file1.kamacoder.com/i/algo/20230117165628.png) 那么为什么一旦[0,i] 区间和为负数,起始位置就可以是i+1呢,i+1后面就不会出现更大的负数? @@ -152,7 +152,7 @@ i从0开始累加rest[i],和记为curSum,一旦curSum小于零,说明[0, i 那有没有可能 [0,i] 区间 选某一个作为起点,累加到 i这里 curSum是不会小于零呢? 如图: -![](https://file.kamacoder.com/pics/20230117170703.png) +![](https://file1.kamacoder.com/i/algo/20230117170703.png) 如果 curSum<0 说明 区间和1 + 区间和2 < 0, 那么 假设从上图中的位置开始计数curSum不会小于0的话,就是 区间和2>0。 diff --git "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" old mode 100644 new mode 100755 index 30df21495e..9701f0f0c1 --- "a/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" +++ "b/problems/0135.\345\210\206\345\217\221\347\263\226\346\236\234.md" @@ -56,7 +56,7 @@ for (int i = 1; i < ratings.size(); i++) { 如图: -![135.分发糖果](https://file.kamacoder.com/pics/20201117114916878.png) +![135.分发糖果](https://file1.kamacoder.com/i/algo/20201117114916878.png) 再确定左孩子大于右孩子的情况(从后向前遍历) @@ -66,7 +66,7 @@ for (int i = 1; i < ratings.size(); i++) { 如果从前向后遍历,rating[5]与rating[4]的比较 就不能用上 rating[5]与rating[6]的比较结果了 。如图: -![](https://file.kamacoder.com/pics/20230202102044.png) +![](https://file1.kamacoder.com/i/algo/20230202102044.png) **所以确定左孩子大于右孩子的情况一定要从后向前遍历!** @@ -82,7 +82,7 @@ for (int i = 1; i < ratings.size(); i++) { 如图: -![135.分发糖果1](https://file.kamacoder.com/pics/20201117115658791.png) +![135.分发糖果1](https://file1.kamacoder.com/i/algo/20201117115658791.png) 所以该过程代码如下: diff --git "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" old mode 100644 new mode 100755 index 513d327ba1..2015cb90c1 --- "a/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" +++ "b/problems/0139.\345\215\225\350\257\215\346\213\206\345\210\206.md" @@ -180,7 +180,7 @@ dp[0]表示如果字符串为空的话,说明出现在字典里。 以输入: s = "leetcode", wordDict = ["leet", "code"]为例,dp状态如图: -![139.单词拆分](https://file.kamacoder.com/pics/20210202162652727.jpg) +![139.单词拆分](https://file1.kamacoder.com/i/algo/20210202162652727.jpg) dp[s.size()]就是最终结果。 @@ -241,7 +241,7 @@ public: 使用用例:s = "applepenapple", wordDict = ["apple", "pen"],对应的dp数组状态如下: -![](https://file.kamacoder.com/pics/20240809155103.png) +![](https://file1.kamacoder.com/i/algo/20240809155103.png) 最后dp[s.size()] = 0 即 dp[13] = 0 ,而不是1,因为先用 "apple" 去遍历的时候,dp[8]并没有被赋值为1 (还没用"pen"),所以 dp[13]也不能变成1。 diff --git "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" old mode 100644 new mode 100755 index 685a92d529..d3583ba866 --- "a/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" +++ "b/problems/0141.\347\216\257\345\275\242\351\223\276\350\241\250.md" @@ -13,7 +13,7 @@ 如果链表中存在环,则返回 true 。 否则,返回 false 。 -![](https://file.kamacoder.com/pics/20210727173600.png) +![](https://file1.kamacoder.com/i/algo/20210727173600.png) ## 思路 @@ -29,7 +29,7 @@ 会发现最终都是这种情况, 如下图: - + fast和slow各自再走一步, fast和slow就相遇了 @@ -38,7 +38,7 @@ fast和slow各自再走一步, fast和slow就相遇了 动画如下: -![141.环形链表](https://code-thinking.cdn.bcebos.com/gifs/141.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8.gif) +![141.环形链表](https://file1.kamacoder.com/i/algo/141.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8.gif) C++代码如下 diff --git "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" old mode 100644 new mode 100755 index 6cfabc60f6..4fd81ef0f5 --- "a/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" +++ "b/problems/0142.\347\216\257\345\275\242\351\223\276\350\241\250II.md" @@ -20,7 +20,7 @@ **说明**:不允许修改给定的链表。 -![循环链表](https://file.kamacoder.com/pics/20200816110112704.png) +![循环链表](https://file1.kamacoder.com/i/algo/20200816110112704.png) ## 算法公开课 @@ -50,7 +50,7 @@ 会发现最终都是这种情况, 如下图: -![142环形链表1](https://file.kamacoder.com/pics/20210318162236720.png) +![142环形链表1](https://file1.kamacoder.com/i/algo/20210318162236720.png) fast和slow各自再走一步, fast和slow就相遇了 @@ -59,7 +59,7 @@ fast和slow各自再走一步, fast和slow就相遇了 动画如下: -![141.环形链表](https://code-thinking.cdn.bcebos.com/gifs/141.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8.gif) +![141.环形链表](https://file1.kamacoder.com/i/algo/141.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8.gif) ### 如果有环,如何找到这个环的入口 @@ -70,7 +70,7 @@ fast和slow各自再走一步, fast和slow就相遇了 环形入口节点到 fast指针与slow指针相遇节点 节点数为y。 从相遇节点 再到环形入口节点节点数为 z。 如图所示: -![](https://file.kamacoder.com/pics/20220925103433.png) +![](https://file1.kamacoder.com/i/algo/20220925103433.png) 那么相遇时: slow指针走过的节点数为: `x + y`, @@ -103,7 +103,7 @@ fast指针走过的节点数:` x + y + n (y + z)`,n为fast指针在环内走 动画如下: -![142.环形链表II(求入口)](https://code-thinking.cdn.bcebos.com/gifs/142.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8II%EF%BC%88%E6%B1%82%E5%85%A5%E5%8F%A3%EF%BC%89.gif) +![142.环形链表II(求入口)](https://file1.kamacoder.com/i/algo/142.%E7%8E%AF%E5%BD%A2%E9%93%BE%E8%A1%A8II%EF%BC%88%E6%B1%82%E5%85%A5%E5%8F%A3%EF%BC%89.gif) 那么 n如果大于1是什么情况呢,就是fast指针在环形转n圈之后才遇到 slow指针。 @@ -154,20 +154,20 @@ public: 即文章[链表:环找到了,那入口呢?](https://programmercarl.com/0142.环形链表II.html)中如下的地方: -![142环形链表5](https://file.kamacoder.com/pics/20210318165123581.png) +![142环形链表5](https://file1.kamacoder.com/i/algo/20210318165123581.png) 首先slow进环的时候,fast一定是先进环来了。 如果slow进环入口,fast也在环入口,那么把这个环展开成直线,就是如下图的样子: -![142环形链表3](https://file.kamacoder.com/pics/2021031816503266.png) +![142环形链表3](https://file1.kamacoder.com/i/algo/2021031816503266.png) 可以看出如果slow 和 fast同时在环入口开始走,一定会在环入口3相遇,slow走了一圈,fast走了两圈。 重点来了,slow进环的时候,fast一定是在环的任意一个位置,如图: -![142环形链表4](https://file.kamacoder.com/pics/2021031816515727.png) +![142环形链表4](https://file1.kamacoder.com/i/algo/2021031816515727.png) 那么fast指针走到环入口3的时候,已经走了k + n 个节点,slow相应的应该走了(k + n) / 2 个节点。 diff --git "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" old mode 100644 new mode 100755 index 98488bc11d..e7056913ee --- "a/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" +++ "b/problems/0143.\351\207\215\346\216\222\351\223\276\350\241\250.md" @@ -6,7 +6,7 @@ [力扣题目链接](https://leetcode.cn/problems/reorder-list/submissions/) -![](https://file.kamacoder.com/pics/20210726160122.png) +![](https://file1.kamacoder.com/i/algo/20210726160122.png) ## 思路 @@ -96,7 +96,7 @@ public: 如图: - + 这种方法,比较难,平均切割链表,看上去很简单,真正代码写的时候有很多细节,同时两个链表最后拼装整一个新的链表也有一些细节需要注意! diff --git "a/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" "b/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" old mode 100644 new mode 100755 index 6d21452d1d..de56c51ff7 --- "a/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" +++ "b/problems/0150.\351\200\206\346\263\242\345\205\260\350\241\250\350\276\276\345\274\217\346\261\202\345\200\274.md" @@ -78,7 +78,7 @@ 在进一步看,本题中每一个子表达式要得出一个结果,然后拿这个结果再进行运算,那么**这岂不就是一个相邻字符串消除的过程,和[1047.删除字符串中的所有相邻重复项](https://programmercarl.com/1047.删除字符串中的所有相邻重复项.html)中的对对碰游戏是不是就非常像了。** 如动画所示: -![150.逆波兰表达式求值](https://code-thinking.cdn.bcebos.com/gifs/150.逆波兰表达式求值.gif) +![150.逆波兰表达式求值](https://file1.kamacoder.com/i/algo/150.逆波兰表达式求值.gif) 相信看完动画大家应该知道,这和[1047. 删除字符串中的所有相邻重复项](https://programmercarl.com/1047.删除字符串中的所有相邻重复项.html)是差不多的,只不过本题不要相邻元素做消除了,而是做运算! diff --git "a/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" "b/problems/0151.\347\277\273\350\275\254\345\255\227\347\254\246\344\270\262\351\207\214\347\232\204\345\215\225\350\257\215.md" old mode 100644 new mode 100755 diff --git "a/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" "b/problems/0160.\347\233\270\344\272\244\351\223\276\350\241\250.md" old mode 100644 new mode 100755 diff --git "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" old mode 100644 new mode 100755 index a3fc7ef126..350533d8c8 --- "a/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" +++ "b/problems/0188.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272IV.md" @@ -132,7 +132,7 @@ for (int j = 1; j < 2 * k; j += 2) { 以输入[1,2,3,4,5],k=2为例。 -![188.买卖股票的最佳时机IV](https://file.kamacoder.com/pics/20201229100358221.png) +![188.买卖股票的最佳时机IV](https://file1.kamacoder.com/i/algo/20201229100358221.png) 最后一次卖出,一定是利润最大的,dp[prices.size() - 1][2 * k]即红色部分就是最后求解。 diff --git "a/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" "b/problems/0189.\346\227\213\350\275\254\346\225\260\347\273\204.md" old mode 100644 new mode 100755 diff --git "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" old mode 100644 new mode 100755 index 0bee40f7cd..7c0aab8ec0 --- "a/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" +++ "b/problems/0198.\346\211\223\345\256\266\345\212\253\350\210\215.md" @@ -87,7 +87,7 @@ for (int i = 2; i < nums.size(); i++) { 以示例二,输入[2,7,9,3,1]为例。 -![198.打家劫舍](https://file.kamacoder.com/pics/20210221170954115.jpg) +![198.打家劫舍](https://file1.kamacoder.com/i/algo/20210221170954115.jpg) 红框dp[nums.size() - 1]为结果。 diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" old mode 100644 new mode 100755 index 9ea47329bb..7ae44b5222 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\345\271\277\346\220\234\347\211\210.md" @@ -13,7 +13,7 @@ 此外,你可以假设该网格的四条边均被水包围。 -![](https://file.kamacoder.com/pics/20220726093256.png) +![](https://file1.kamacoder.com/i/algo/20220726093256.png) 提示: @@ -28,7 +28,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 @@ -48,7 +48,7 @@ 如果从队列拿出节点,再去标记这个节点走过,就会发生下图所示的结果,会导致很多节点重复加入队列。 -![图二](https://file.kamacoder.com/pics/20220727100846.png) +![图二](https://file1.kamacoder.com/i/algo/20220727100846.png) 超时写法 (从队列中取出节点再标记) diff --git "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" old mode 100644 new mode 100755 index a015399859..128007bb62 --- "a/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" +++ "b/problems/0200.\345\262\233\345\261\277\346\225\260\351\207\217.\346\267\261\346\220\234\347\211\210.md" @@ -12,7 +12,7 @@ 此外,你可以假设该网格的四条边均被水包围。 -![](https://file.kamacoder.com/pics/20220726093256.png) +![](https://file1.kamacoder.com/i/algo/20220726093256.png) 提示: @@ -27,7 +27,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 diff --git "a/problems/0202.\345\277\253\344\271\220\346\225\260.md" "b/problems/0202.\345\277\253\344\271\220\346\225\260.md" old mode 100644 new mode 100755 diff --git "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" old mode 100644 new mode 100755 index 5ecf89bf19..ffe04a5b07 --- "a/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" +++ "b/problems/0203.\347\247\273\351\231\244\351\223\276\350\241\250\345\205\203\347\264\240.md" @@ -34,11 +34,11 @@ 这里以链表 1 4 2 4 来举例,移除元素4。 -![203_链表删除元素1](https://file.kamacoder.com/pics/20210316095351161.png) +![203_链表删除元素1](https://file1.kamacoder.com/i/algo/20210316095351161.png) 如果使用C,C++编程语言的话,不要忘了还要从内存中删除这两个移除的节点, 清理节点内存之后如图: -![203_链表删除元素2](https://file.kamacoder.com/pics/20210316095418280.png) +![203_链表删除元素2](https://file1.kamacoder.com/i/algo/20210316095418280.png) **当然如果使用java ,python的话就不用手动管理内存了。** @@ -56,16 +56,16 @@ 来看第一种操作:直接使用原来的链表来进行移除。 -![203_链表删除元素3](https://file.kamacoder.com/pics/2021031609544922.png) +![203_链表删除元素3](https://file1.kamacoder.com/i/algo/2021031609544922.png) 移除头结点和移除其他节点的操作是不一样的,因为链表的其他节点都是通过前一个节点来移除当前节点,而头结点没有前一个节点。 所以头结点如何移除呢,其实只要将头结点向后移动一位就可以,这样就从链表中移除了一个头结点。 -![203_链表删除元素4](https://file.kamacoder.com/pics/20210316095512470.png) +![203_链表删除元素4](https://file1.kamacoder.com/i/algo/20210316095512470.png) 依然别忘将原头结点从内存中删掉。 -![203_链表删除元素5](https://file.kamacoder.com/pics/20210316095543775.png) +![203_链表删除元素5](https://file1.kamacoder.com/i/algo/20210316095543775.png) 这样移除了一个头结点,是不是发现,在单链表中移除头结点 和 移除其他节点的操作方式是不一样,其实在写代码的时候也会发现,需要单独写一段逻辑来处理移除头结点的情况。 @@ -76,7 +76,7 @@ 来看看如何设置一个虚拟头。依然还是在这个链表中,移除元素1。 -![203_链表删除元素6](https://file.kamacoder.com/pics/20210316095619221.png) +![203_链表删除元素6](https://file1.kamacoder.com/i/algo/20210316095619221.png) 这里来给链表添加一个虚拟头结点为新的头结点,此时要移除这个旧头结点元素1。 diff --git "a/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" "b/problems/0205.\345\220\214\346\236\204\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 diff --git "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" old mode 100644 new mode 100755 index 4e33342a67..e49037dd2b --- "a/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" +++ "b/problems/0206.\347\277\273\350\275\254\351\223\276\350\241\250.md" @@ -27,7 +27,7 @@ 其实只需要改变链表的next指针的指向,直接将链表反转 ,而不用重新定义一个新的链表,如图所示: -![206_反转链表](https://file.kamacoder.com/pics/20210218090901207.png) +![206_反转链表](https://file1.kamacoder.com/i/algo/20210218090901207.png) 之前链表的头节点是元素1, 反转之后头结点就是元素5 ,这里并没有添加或者删除节点,仅仅是改变next指针的方向。 @@ -35,7 +35,7 @@ 我们拿有示例中的链表来举例,如动画所示:(纠正:动画应该是先移动pre,在移动cur) -![](https://code-thinking.cdn.bcebos.com/gifs/206.%E7%BF%BB%E8%BD%AC%E9%93%BE%E8%A1%A8.gif) +![](https://file1.kamacoder.com/i/algo/206.%E7%BF%BB%E8%BD%AC%E9%93%BE%E8%A1%A8.gif) 首先定义一个cur指针,指向头结点,再定义一个pre指针,初始化为null。 diff --git "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" old mode 100644 new mode 100755 index ca24bc4234..40917f9b8e --- "a/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0209.\351\225\277\345\272\246\346\234\200\345\260\217\347\232\204\345\255\220\346\225\260\347\273\204.md" @@ -84,7 +84,7 @@ public: 这里还是以题目中的示例来举例,s=7, 数组是 2,3,1,2,4,3,来看一下查找的过程: -![209.长度最小的子数组](https://code-thinking.cdn.bcebos.com/gifs/209.%E9%95%BF%E5%BA%A6%E6%9C%80%E5%B0%8F%E7%9A%84%E5%AD%90%E6%95%B0%E7%BB%84.gif) +![209.长度最小的子数组](https://file1.kamacoder.com/i/algo/209.%E9%95%BF%E5%BA%A6%E6%9C%80%E5%B0%8F%E7%9A%84%E5%AD%90%E6%95%B0%E7%BB%84.gif) 最后找到 4,3 是最短距离。 @@ -104,7 +104,7 @@ public: 解题的关键在于 窗口的起始位置如何移动,如图所示: -![leetcode_209](https://file.kamacoder.com/pics/20210312160441942.png) +![leetcode_209](https://file1.kamacoder.com/i/algo/20210312160441942.png) 可以发现**滑动窗口的精妙之处在于根据当前子序列和大小的情况,不断调节子序列的起始位置。从而将O(n^2)暴力解法降为O(n)。** diff --git "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" old mode 100644 new mode 100755 index 8fceb0a91e..6f2fdd0610 --- "a/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" +++ "b/problems/0213.\346\211\223\345\256\266\345\212\253\350\210\215II.md" @@ -42,15 +42,15 @@ * 情况一:考虑不包含首尾元素 -![213.打家劫舍II](https://file.kamacoder.com/pics/20210129160748643-20230310134000692.jpg) +![213.打家劫舍II](https://file1.kamacoder.com/i/algo/20210129160748643-20230310134000692.jpg) * 情况二:考虑包含首元素,不包含尾元素 -![213.打家劫舍II1](https://file.kamacoder.com/pics/20210129160821374-20230310134003961.jpg) +![213.打家劫舍II1](https://file1.kamacoder.com/i/algo/20210129160821374-20230310134003961.jpg) * 情况三:考虑包含尾元素,不包含首元素 -![213.打家劫舍II2](https://file.kamacoder.com/pics/20210129160842491-20230310134008133.jpg) +![213.打家劫舍II2](https://file1.kamacoder.com/i/algo/20210129160842491-20230310134008133.jpg) **注意我这里用的是"考虑"**,例如情况三,虽然是考虑包含尾元素,但不一定要选尾部元素! 对于情况三,取nums[1] 和 nums[3]就是最大的。 diff --git "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" old mode 100644 new mode 100755 index e23be78d5e..2da0372b1a --- "a/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" +++ "b/problems/0216.\347\273\204\345\220\210\346\200\273\345\222\214III.md" @@ -45,7 +45,7 @@ 选取过程如图: -![216.组合总和III](https://file.kamacoder.com/pics/20201123195717975.png) +![216.组合总和III](https://file1.kamacoder.com/i/algo/20201123195717975.png) 图中,可以看出,只有最后取到集合(1,3)和为4 符合条件。 @@ -108,7 +108,7 @@ if (path.size() == k) { 本题和[77. 组合](https://programmercarl.com/0077.组合.html)区别之一就是集合固定的就是9个数[1,...,9],所以for循环固定i<=9 如图: -![216.组合总和III](https://file.kamacoder.com/pics/20201123195717975-20230310113546003.png) +![216.组合总和III](https://file1.kamacoder.com/i/algo/20201123195717975-20230310113546003.png) 处理过程就是 path收集每次选取的元素,相当于树型结构里的边,sum来统计path里元素的总和。 @@ -166,7 +166,7 @@ public: 这道题目,剪枝操作其实是很容易想到了,想必大家看上面的树形图的时候已经想到了。 如图: -![216.组合总和III1](https://file.kamacoder.com/pics/2020112319580476.png) +![216.组合总和III1](https://file1.kamacoder.com/i/algo/2020112319580476.png) 已选元素总和如果已经大于n(图中数值为4)了,那么往后遍历就没有意义了,直接剪掉。 diff --git "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" old mode 100644 new mode 100755 index 37ae7819aa..eaf4eab2c9 --- "a/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" +++ "b/problems/0222.\345\256\214\345\205\250\344\272\214\345\217\211\346\240\221\347\232\204\350\212\202\347\202\271\344\270\252\346\225\260.md" @@ -153,7 +153,7 @@ public: 我来举一个典型的例子如题: - + 完全二叉树只有两种情况,情况一:就是满二叉树,情况二:最后一层叶子节点没有满。 @@ -162,10 +162,10 @@ public: 对于情况二,分别递归左孩子,和右孩子,递归到某一深度一定会有左孩子或者右孩子为满二叉树,然后依然可以按照情况1来计算。 完全二叉树(一)如图: -![222.完全二叉树的节点个数](https://file.kamacoder.com/pics/20201124092543662.png) +![222.完全二叉树的节点个数](https://file1.kamacoder.com/i/algo/20201124092543662.png) 完全二叉树(二)如图: -![222.完全二叉树的节点个数1](https://file.kamacoder.com/pics/20201124092634138.png) +![222.完全二叉树的节点个数1](https://file1.kamacoder.com/i/algo/20201124092634138.png) 可以看出如果整个树不是满二叉树,就递归其左右孩子,直到遇到满二叉树为止,用公式计算这个子树(满二叉树)的节点数量。 @@ -173,15 +173,15 @@ public: 在完全二叉树中,如果递归向左遍历的深度等于递归向右遍历的深度,那说明就是满二叉树。如图: -![](https://file.kamacoder.com/pics/20220829163554.png) +![](https://file1.kamacoder.com/i/algo/20220829163554.png) 在完全二叉树中,如果递归向左遍历的深度不等于递归向右遍历的深度,则说明不是满二叉树,如图: -![](https://file.kamacoder.com/pics/20220829163709.png) +![](https://file1.kamacoder.com/i/algo/20220829163709.png) 那有录友说了,这种情况,递归向左遍历的深度等于递归向右遍历的深度,但也不是满二叉树,如题: -![](https://file.kamacoder.com/pics/20220829163811.png) +![](https://file1.kamacoder.com/i/algo/20220829163811.png) 如果这么想,大家就是对 完全二叉树理解有误区了,**以上这棵二叉树,它根本就不是一个完全二叉树**! diff --git "a/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" "b/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" old mode 100644 new mode 100755 index 2396858056..72dfd2aacf --- "a/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" +++ "b/problems/0225.\347\224\250\351\230\237\345\210\227\345\256\236\347\216\260\346\240\210.md" @@ -60,7 +60,7 @@ queue.pop(); queue.empty(); ``` -![225.用队列实现栈](https://code-thinking.cdn.bcebos.com/gifs/225.用队列实现栈.gif) +![225.用队列实现栈](https://file1.kamacoder.com/i/algo/225.用队列实现栈.gif) 详细如代码注释所示: diff --git "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index 248a28a4d5..67a1a59338 --- "a/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0226.\347\277\273\350\275\254\344\272\214\345\217\211\346\240\221.md" @@ -10,7 +10,7 @@ 翻转一棵二叉树。 -![226.翻转二叉树](https://file.kamacoder.com/pics/20210203192644329.png) +![226.翻转二叉树](https://file1.kamacoder.com/i/algo/20210203192644329.png) 这道题目背后有一个让程序员心酸的故事,听说 Homebrew的作者Max Howell,就是因为没在白板上写出翻转二叉树,最后被Google拒绝了。(真假不做判断,全当一个乐子哈) @@ -35,7 +35,7 @@ 如果要从整个树来看,翻转还真的挺复杂,整个树以中间分割线进行翻转,如图: -![226.翻转二叉树1](https://file.kamacoder.com/pics/20210203192724351.png) +![226.翻转二叉树1](https://file1.kamacoder.com/i/algo/20210203192724351.png) 可以发现想要翻转它,其实就把每一个节点的左右孩子交换一下就可以了。 @@ -55,7 +55,7 @@ 我们下文以前序遍历为例,通过动画来看一下翻转的过程: -![翻转二叉树](https://code-thinking.cdn.bcebos.com/gifs/%E7%BF%BB%E8%BD%AC%E4%BA%8C%E5%8F%89%E6%A0%91.gif) +![翻转二叉树](https://file1.kamacoder.com/i/algo/%E7%BF%BB%E8%BD%AC%E4%BA%8C%E5%8F%89%E6%A0%91.gif) 我们来看一下递归三部曲: diff --git "a/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" "b/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" old mode 100644 new mode 100755 index 6775a37265..56698e023f --- "a/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" +++ "b/problems/0232.\347\224\250\346\240\210\345\256\236\347\216\260\351\230\237\345\210\227.md" @@ -57,7 +57,7 @@ queue.pop();**注意此时的输出栈的操作** queue.pop(); queue.empty(); -![232.用栈实现队列版本2](https://code-thinking.cdn.bcebos.com/gifs/232.用栈实现队列版本2.gif) +![232.用栈实现队列版本2](https://file1.kamacoder.com/i/algo/232.用栈实现队列版本2.gif) 在push数据的时候,只要数据放进输入栈就好,**但在pop的时候,操作就复杂一些,输出栈如果为空,就把进栈数据全部导入进来(注意是全部导入)**,再从出栈弹出数据,如果输出栈不为空,则直接从出栈弹出数据就可以了。 diff --git "a/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" "b/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" old mode 100644 new mode 100755 index f493383967..6248861d94 --- "a/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" +++ "b/problems/0234.\345\233\236\346\226\207\351\223\276\350\241\250.md" @@ -87,7 +87,7 @@ public: 如图所示: - + 代码如下: diff --git "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" old mode 100644 new mode 100755 index 98cc5b7da8..a1fe78d169 --- "a/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0235.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -14,7 +14,7 @@ 例如,给定如下二叉搜索树:  root = [6,2,8,0,4,7,9,null,null,3,5] -![235. 二叉搜索树的最近公共祖先](https://file.kamacoder.com/pics/20201018172243602.png) +![235. 二叉搜索树的最近公共祖先](https://file1.kamacoder.com/i/algo/20201018172243602.png) 示例 1: @@ -52,7 +52,7 @@ 如图,我们从根节点搜索,第一次遇到 cur节点是数值在[q, p]区间中,即 节点5,此时可以说明 q 和 p 一定分别存在于 节点 5的左子树,和右子树中。 -![235.二叉搜索树的最近公共祖先](https://file.kamacoder.com/pics/20220926164214.png) +![235.二叉搜索树的最近公共祖先](https://file1.kamacoder.com/i/algo/20220926164214.png) 此时节点5是不是最近公共祖先? 如果 从节点5继续向左遍历,那么将错过成为p的祖先, 如果从节点5继续向右遍历则错过成为q的祖先。 @@ -64,7 +64,7 @@ 如图所示:p为节点6,q为节点9 -![235.二叉搜索树的最近公共祖先2](https://file.kamacoder.com/pics/20220926165141.png) +![235.二叉搜索树的最近公共祖先2](https://file1.kamacoder.com/i/algo/20220926165141.png) 可以看出直接按照指定的方向,就可以找到节点8,为最近公共祖先,而且不需要遍历整棵树,找到结果直接返回! diff --git "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" old mode 100644 new mode 100755 index 537d624084..5044e3ba00 --- "a/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" +++ "b/problems/0236.\344\272\214\345\217\211\346\240\221\347\232\204\346\234\200\350\277\221\345\205\254\345\205\261\347\245\226\345\205\210.md" @@ -16,7 +16,7 @@ 例如,给定如下二叉树:  root = [3,5,1,6,2,0,8,null,null,7,4] -![236. 二叉树的最近公共祖先](https://file.kamacoder.com/pics/20201016173414722.png) +![236. 二叉树的最近公共祖先](https://file1.kamacoder.com/i/algo/20201016173414722.png) 示例 1: 输入: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1 @@ -51,7 +51,7 @@ **首先最容易想到的一个情况:如果找到一个节点,发现左子树出现结点p,右子树出现节点q,或者 左子树出现结点q,右子树出现节点p,那么该节点就是节点p和q的最近公共祖先。** 即情况一: -![](https://file.kamacoder.com/pics/20220922173502.png) +![](https://file1.kamacoder.com/i/algo/20220922173502.png) 判断逻辑是 如果递归遍历遇到q,就将q返回,遇到p 就将p返回,那么如果 左右子树的返回值都不为空,说明此时的中节点,一定是q 和p 的最近祖先。 @@ -61,7 +61,7 @@ **但是很多人容易忽略一个情况,就是节点本身p(q),它拥有一个子孙节点q(p)。** 情况二: -![](https://file.kamacoder.com/pics/20220922173530.png) +![](https://file1.kamacoder.com/i/algo/20220922173530.png) 其实情况一 和 情况二 代码实现过程都是一样的,也可以说,实现情况一的逻辑,顺便包含了情况二。 @@ -129,7 +129,7 @@ left与right的逻辑处理; // 中 如图: -![236.二叉树的最近公共祖先](https://file.kamacoder.com/pics/2021020415105872.png) +![236.二叉树的最近公共祖先](https://file1.kamacoder.com/i/algo/2021020415105872.png) 就像图中一样直接返回7。 @@ -162,7 +162,7 @@ TreeNode* right = lowestCommonAncestor(root->right, p, q); 如图: -![236.二叉树的最近公共祖先1](https://file.kamacoder.com/pics/20210204151125844.png) +![236.二叉树的最近公共祖先1](https://file1.kamacoder.com/i/algo/20210204151125844.png) 图中节点10的左子树返回null,右子树返回目标值7,那么此时节点10的处理逻辑就是把右子树的返回值(最近公共祖先7)返回上去! @@ -183,7 +183,7 @@ else { // (left == NULL && right == NULL) 那么寻找最小公共祖先,完整流程图如下: -![236.二叉树的最近公共祖先2](https://file.kamacoder.com/pics/202102041512582.png) +![236.二叉树的最近公共祖先2](https://file1.kamacoder.com/i/algo/202102041512582.png) **从图中,大家可以看到,我们是如何回溯遍历整棵二叉树,将结果返回给头结点的!** diff --git "a/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" "b/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" old mode 100644 new mode 100755 index 875f1bd193..5ea810104d --- "a/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" +++ "b/problems/0239.\346\273\221\345\212\250\347\252\227\345\217\243\346\234\200\345\244\247\345\200\274.md" @@ -18,7 +18,7 @@ 你能在线性时间复杂度内解决此题吗? - + 提示: @@ -82,7 +82,7 @@ public: 动画如下: -![239.滑动窗口最大值](https://code-thinking.cdn.bcebos.com/gifs/239.滑动窗口最大值.gif) +![239.滑动窗口最大值](https://file1.kamacoder.com/i/algo/239.滑动窗口最大值.gif) 对于窗口里的元素{2, 3, 5, 1 ,4},单调队列里只维护{5, 4} 就够了,保持单调队列里单调递减,此时队列出口元素就是窗口里最大元素。 @@ -98,7 +98,7 @@ public: 为了更直观的感受到单调队列的工作过程,以题目示例为例,输入: nums = [1,3,-1,-3,5,3,6,7], 和 k = 3,动画如下: -![239.滑动窗口最大值-2](https://code-thinking.cdn.bcebos.com/gifs/239.滑动窗口最大值-2.gif) +![239.滑动窗口最大值-2](https://file1.kamacoder.com/i/algo/239.滑动窗口最大值-2.gif) 那么我们用什么数据结构来实现这个单调队列呢? diff --git "a/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" "b/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" old mode 100644 new mode 100755 index 9a783e5b11..0a37ea26cc --- "a/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" +++ "b/problems/0242.\346\234\211\346\225\210\347\232\204\345\255\227\346\257\215\345\274\202\344\275\215\350\257\215.md" @@ -42,7 +42,7 @@ 操作动画如下: -![242.有效的字母异位词](https://code-thinking.cdn.bcebos.com/gifs/242.%E6%9C%89%E6%95%88%E7%9A%84%E5%AD%97%E6%AF%8D%E5%BC%82%E4%BD%8D%E8%AF%8D.gif) +![242.有效的字母异位词](https://file1.kamacoder.com/i/algo/242.%E6%9C%89%E6%95%88%E7%9A%84%E5%AD%97%E6%AF%8D%E5%BC%82%E4%BD%8D%E8%AF%8D.gif) 定义一个数组叫做record用来上记录字符串s里字符出现的次数。 diff --git "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" old mode 100644 new mode 100755 index 5d71351172..4a66c816bc --- "a/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" +++ "b/problems/0257.\344\272\214\345\217\211\346\240\221\347\232\204\346\211\200\346\234\211\350\267\257\345\276\204.md" @@ -14,7 +14,7 @@ 说明: 叶子节点是指没有子节点的节点。 示例: -![257.二叉树的所有路径1](https://file.kamacoder.com/pics/2021020415161576.png) +![257.二叉树的所有路径1](https://file1.kamacoder.com/i/algo/2021020415161576.png) ## 算法公开课 @@ -28,7 +28,7 @@ 前序遍历以及回溯的过程如图: -![257.二叉树的所有路径](https://file.kamacoder.com/pics/20210204151702443.png) +![257.二叉树的所有路径](https://file1.kamacoder.com/i/algo/20210204151702443.png) 我们先使用递归的方式,来做前序遍历。**要知道递归和回溯就是一家的,本题也需要回溯。** @@ -315,7 +315,7 @@ public: 其实关键还在于 参数,使用的是 `string path`,这里并没有加上引用`&` ,即本层递归中,path + 该节点数值,但该层递归结束,上一层path的数值并不会受到任何影响。 如图所示: -![](https://file.kamacoder.com/pics/20220831173322.png) +![](https://file1.kamacoder.com/i/algo/20220831173322.png) 节点4 的path,在遍历到节点3,path+3,遍历节点3的递归结束之后,返回节点4(回溯的过程),path并不会把3加上。 diff --git "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" old mode 100644 new mode 100755 index 8171a409a0..7c5d7c9c9f --- "a/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" +++ "b/problems/0279.\345\256\214\345\205\250\345\271\263\346\226\271\346\225\260.md" @@ -93,7 +93,7 @@ for (int i = 0; i <= n; i++) { // 遍历背包 已输入n为5例,dp状态图如下: -![279.完全平方数](https://file.kamacoder.com/pics/20210202112617341.jpg) +![279.完全平方数](https://file1.kamacoder.com/i/algo/20210202112617341.jpg) dp[0] = 0 dp[1] = min(dp[0] + 1) = 1 diff --git "a/problems/0283.\347\247\273\345\212\250\351\233\266.md" "b/problems/0283.\347\247\273\345\212\250\351\233\266.md" old mode 100644 new mode 100755 index d7911054e4..e25525684e --- "a/problems/0283.\347\247\273\345\212\250\351\233\266.md" +++ "b/problems/0283.\347\247\273\345\212\250\351\233\266.md" @@ -32,7 +32,7 @@ 如动画所示: -![移动零](https://code-thinking.cdn.bcebos.com/gifs/283.%E7%A7%BB%E5%8A%A8%E9%9B%B6.gif) +![移动零](https://file1.kamacoder.com/i/algo/283.%E7%A7%BB%E5%8A%A8%E9%9B%B6.gif) C++代码如下: diff --git "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index de37ed5cc8..06adfd950d --- "a/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0300.\346\234\200\351\225\277\344\270\212\345\215\207\345\255\220\345\272\217\345\210\227.md" @@ -85,7 +85,7 @@ for (int i = 1; i < nums.size(); i++) { 输入:[0,1,0,3,2],dp数组的变化如下: -![300.最长上升子序列](https://file.kamacoder.com/pics/20210110170945618.jpg) +![300.最长上升子序列](https://file1.kamacoder.com/i/algo/20210110170945618.jpg) 如果代码写出来,但一直AC不了,那么就把dp数组打印出来,看看对不对! diff --git "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" old mode 100644 new mode 100755 index 599a1f42e1..d396e521b3 --- "a/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" +++ "b/problems/0309.\346\234\200\344\275\263\344\271\260\345\215\226\350\202\241\347\245\250\346\227\266\346\234\272\345\220\253\345\206\267\345\206\273\346\234\237.md" @@ -47,7 +47,7 @@ dp[i][j],第i天状态为j,所剩的最多现金为dp[i][j]。 * 状态三:今天卖出股票 * 状态四:今天为冷冻期状态,但冷冻期状态不可持续,只有一天! -![](https://file.kamacoder.com/pics/518d5baaf33f4b2698064f8efb42edbf.png) +![](https://file1.kamacoder.com/i/algo/518d5baaf33f4b2698064f8efb42edbf.png) j的状态为: @@ -136,7 +136,7 @@ dp[i][3] = dp[i - 1][2]; 以 [1,2,3,0,2] 为例,dp数组如下: -![309.最佳买卖股票时机含冷冻期](https://file.kamacoder.com/pics/2021032317451040.png) +![309.最佳买卖股票时机含冷冻期](https://file1.kamacoder.com/i/algo/2021032317451040.png) 最后结果是取 状态二,状态三,和状态四的最大值,不少同学会把状态四忘了,状态四是冷冻期,最后一天如果是冷冻期也可能是最大值。 diff --git "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" old mode 100644 new mode 100755 index 7f3bc1e4b1..f3a0a07dd9 --- "a/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" +++ "b/problems/0322.\351\233\266\351\222\261\345\205\221\346\215\242.md" @@ -104,7 +104,7 @@ dp[0] = 0; 以输入:coins = [1, 2, 5], amount = 5为例 -![322.零钱兑换](https://file.kamacoder.com/pics/20210201111833906.jpg) +![322.零钱兑换](https://file1.kamacoder.com/i/algo/20210201111833906.jpg) dp[amount]为最终结果。 diff --git "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" old mode 100644 new mode 100755 index fcdb6a33ed..1168277a8d --- "a/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" +++ "b/problems/0332.\351\207\215\346\226\260\345\256\211\346\216\222\350\241\214\347\250\213.md" @@ -57,7 +57,7 @@ 对于死循环,我来举一个有重复机场的例子: -![332.重新安排行程](https://file.kamacoder.com/pics/20201115180537865.png) +![332.重新安排行程](https://file1.kamacoder.com/i/algo/20201115180537865.png) 为什么要举这个例子呢,就是告诉大家,出发机场和到达机场也会重复的,**如果在解题的过程中没有对集合元素处理好,就会死循环。** @@ -111,7 +111,7 @@ void backtracking(参数) { 本题以输入:[["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]为例,抽象为树形结构如下: -![332.重新安排行程1](https://file.kamacoder.com/pics/2020111518065555-20230310121223600.png) +![332.重新安排行程1](https://file1.kamacoder.com/i/algo/2020111518065555-20230310121223600.png) 开始回溯三部曲讲解: @@ -137,7 +137,7 @@ bool backtracking(int ticketNum, vector& result) { 因为我们只需要找到一个行程,就是在树形结构中唯一的一条通向叶子节点的路线,如图: -![332.重新安排行程1](https://file.kamacoder.com/pics/2020111518065555-20230310121240991.png) +![332.重新安排行程1](https://file1.kamacoder.com/i/algo/2020111518065555-20230310121240991.png) 所以找到了这个叶子节点了直接返回,这个递归函数的返回值问题我们在讲解二叉树的系列的时候,在这篇[二叉树:递归函数究竟什么时候需要返回值,什么时候不要返回值?](https://programmercarl.com/0112.路径总和.html)详细介绍过。 diff --git "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" old mode 100644 new mode 100755 index 4916af4c26..44af86bb4c --- "a/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" +++ "b/problems/0337.\346\211\223\345\256\266\345\212\253\350\210\215III.md" @@ -12,7 +12,7 @@ 计算在不触动警报的情况下,小偷一晚能够盗取的最高金额。 -![337.打家劫舍III](https://file.kamacoder.com/pics/20210223173849619.png) +![337.打家劫舍III](https://file1.kamacoder.com/i/algo/20210223173849619.png) ## 算法公开课 @@ -177,7 +177,7 @@ return {val2, val1}; 以示例1为例,dp数组状态如下:(**注意用后序遍历的方式推导**) -![](https://file.kamacoder.com/pics/20230203110031.png) +![](https://file1.kamacoder.com/i/algo/20230203110031.png) **最后头结点就是 取下标0 和 下标1的最大值就是偷得的最大金钱**。 diff --git "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" old mode 100644 new mode 100755 index 203c422879..c9467e361f --- "a/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" +++ "b/problems/0343.\346\225\264\346\225\260\346\213\206\345\210\206.md" @@ -127,7 +127,7 @@ for (int i = 3; i <= n ; i++) { 举例当n为10 的时候,dp数组里的数值,如下: -![343.整数拆分](https://file.kamacoder.com/pics/20210104173021581.png) +![343.整数拆分](https://file1.kamacoder.com/i/algo/20210104173021581.png) 以上动规五部曲分析完毕,C++代码如下: diff --git "a/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" "b/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 index c88d008c82..cadb31c97b --- "a/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0344.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262.md" @@ -69,7 +69,7 @@ 以字符串`hello`为例,过程如下: -![344.反转字符串](https://code-thinking.cdn.bcebos.com/gifs/344.%E5%8F%8D%E8%BD%AC%E5%AD%97%E7%AC%A6%E4%B8%B2.gif) +![344.反转字符串](https://file1.kamacoder.com/i/algo/344.%E5%8F%8D%E8%BD%AC%E5%AD%97%E7%AC%A6%E4%B8%B2.gif) 不难写出如下C++代码: diff --git "a/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" "b/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" old mode 100644 new mode 100755 index b6575c5fd4..fa7d6155a5 --- "a/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" +++ "b/problems/0347.\345\211\215K\344\270\252\351\253\230\351\242\221\345\205\203\347\264\240.md" @@ -70,7 +70,7 @@ 寻找前k个最大元素流程如图所示:(图中的频率只有三个,所以正好构成一个大小为3的小顶堆,如果频率更多一些,则用这个小顶堆进行扫描) -![347.前K个高频元素](https://code-thinking.cdn.bcebos.com/pics/347.前K个高频元素.jpg) +![347.前K个高频元素](https://file1.kamacoder.com/i/algo/347.前K个高频元素.jpg) 我们来看一下C++代码: diff --git "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" old mode 100644 new mode 100755 index 65d22a809c..77e895da61 --- "a/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" +++ "b/problems/0349.\344\270\244\344\270\252\346\225\260\347\273\204\347\232\204\344\272\244\351\233\206.md" @@ -14,7 +14,7 @@ 题意:给定两个数组,编写一个函数来计算它们的交集。 -![349. 两个数组的交集](https://file.kamacoder.com/pics/20200818193523911.png) +![349. 两个数组的交集](https://file1.kamacoder.com/i/algo/20200818193523911.png) **说明:** 输出结果中的每个元素一定是唯一的。 @@ -51,7 +51,7 @@ std::set和std::multiset底层实现都是红黑树,std::unordered_set的底 思路如图所示: -![set哈希法](https://file.kamacoder.com/pics/20220707173513.png) +![set哈希法](https://file1.kamacoder.com/i/algo/20220707173513.png) C++代码如下: diff --git "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index 50934981a6..1be9cb4178 --- "a/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" +++ "b/problems/0376.\346\221\206\345\212\250\345\272\217\345\210\227.md" @@ -46,7 +46,7 @@ 用示例二来举例,如图所示: -![376.摆动序列](https://file.kamacoder.com/pics/20201124174327597.png) +![376.摆动序列](https://file1.kamacoder.com/i/algo/20201124174327597.png) **局部最优:删除单调坡度上的节点(不包括单调坡度两端的节点),那么这个坡度就可以有两个局部峰值**。 @@ -72,13 +72,13 @@ 例如 [1,2,2,2,2,1]这样的数组,如图: -![](https://file.kamacoder.com/pics/20230106170449.png) +![](https://file1.kamacoder.com/i/algo/20230106170449.png) 它的摇摆序列长度是多少呢? **其实是长度是 3**,也就是我们在删除的时候 要不删除左面的三个 2,要不就删除右边的三个 2。 如图,可以统一规则,删除左边的三个 2: -![](https://file.kamacoder.com/pics/20230106172613.png) +![](https://file1.kamacoder.com/i/algo/20230106172613.png) 在图中,当 i 指向第一个 2 的时候,`prediff > 0 && curdiff = 0` ,当 i 指向最后一个 2 的时候 `prediff = 0 && curdiff < 0`。 @@ -106,7 +106,7 @@ 那么为了规则统一,针对序列[2,5],可以假设为[2,2,5],这样它就有坡度了即 preDiff = 0,如图: -![376.摆动序列1](https://file.kamacoder.com/pics/20201124174357612.png) +![376.摆动序列1](https://file1.kamacoder.com/i/algo/20201124174357612.png) 针对以上情形,result 初始为 1(默认最右面有一个峰值),此时 curDiff > 0 && preDiff <= 0,那么 result++(计算了左面的峰值),最后得到的 result 就是 2(峰值个数为 2 即摆动序列长度为 2) @@ -145,7 +145,7 @@ public: 在版本一中,我们忽略了一种情况,即 如果在一个单调坡度上有平坡,例如[1,2,2,2,3,4],如图: -![](https://file.kamacoder.com/pics/20230108171505.png) +![](https://file1.kamacoder.com/i/algo/20230108171505.png) 图中,我们可以看出,版本一的代码在三个地方记录峰值,但其实结果因为是 2,因为 单调中的平坡 不能算峰值(即摆动)。 @@ -184,7 +184,7 @@ public: **本题异常情况的本质,就是要考虑平坡**, 平坡分两种,一个是 上下中间有平坡,一个是单调有平坡,如图: -![](https://file.kamacoder.com/pics/20230108174452.png) +![](https://file1.kamacoder.com/i/algo/20230108174452.png) ### 思路 2(动态规划) diff --git "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" old mode 100644 new mode 100755 index 20a94331c4..ab92f24aef --- "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" +++ "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" @@ -103,7 +103,7 @@ dp[i](考虑nums[j])可以由 dp[i - nums[j]](不考虑nums[j]) 推导 我们再来用示例中的例子推导一下: -![377.组合总和Ⅳ](https://file.kamacoder.com/pics/20230310000625.png) +![377.组合总和Ⅳ](https://file1.kamacoder.com/i/algo/20230310000625.png) 如果代码运行处的结果不是想要的结果,就把dp[i]都打出来,看看和我们推导的一不一样。 diff --git "a/problems/0383.\350\265\216\351\207\221\344\277\241.md" "b/problems/0383.\350\265\216\351\207\221\344\277\241.md" old mode 100644 new mode 100755 diff --git "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index d59b7bc121..bf2d959682 --- "a/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0392.\345\210\244\346\226\255\345\255\220\345\272\217\345\210\227.md" @@ -80,7 +80,7 @@ if (s[i - 1] != t[j - 1]),此时相当于t要删除元素,t如果把当前 因为这样的定义在dp二维矩阵中可以留出初始化的区间,如图: -![392.判断子序列](https://file.kamacoder.com/pics/20210303173115966.png) +![392.判断子序列](https://file1.kamacoder.com/i/algo/20210303173115966.png) 如果要是定义的dp[i][j]是以下标i为结尾的字符串s和以下标j为结尾的字符串t,初始化就比较麻烦了。 @@ -98,14 +98,14 @@ vector> dp(s.size() + 1, vector(t.size() + 1, 0)); 如图所示: -![392.判断子序列1](https://file.kamacoder.com/pics/20210303172354155.jpg) +![392.判断子序列1](https://file1.kamacoder.com/i/algo/20210303172354155.jpg) 5. 举例推导dp数组 以示例一为例,输入:s = "abc", t = "ahbgdc",dp状态转移图如下: -![392.判断子序列2](https://file.kamacoder.com/pics/2021030317364166.jpg) +![392.判断子序列2](https://file1.kamacoder.com/i/algo/2021030317364166.jpg) dp[i][j]表示以下标i-1为结尾的字符串s和以下标j-1为结尾的字符串t 相同子序列的长度,所以如果dp[s.size()][t.size()] 与 字符串s的长度相同说明:s与t的最长相同子序列就是s,那么s 就是 t 的子序列。 diff --git "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" old mode 100644 new mode 100755 index 69723815a1..10b159b181 --- "a/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" +++ "b/problems/0404.\345\267\246\345\217\266\345\255\220\344\271\213\345\222\214.md" @@ -12,7 +12,7 @@ 示例: -![404.左叶子之和1](https://file.kamacoder.com/pics/20210204151927654.png) +![404.左叶子之和1](https://file1.kamacoder.com/i/algo/20210204151927654.png) ## 算法公开课 @@ -26,12 +26,12 @@ 大家思考一下如下图中二叉树,左叶子之和究竟是多少? -![404.左叶子之和](https://file.kamacoder.com/pics/20210204151949672.png) +![404.左叶子之和](https://file1.kamacoder.com/i/algo/20210204151949672.png) **其实是0,因为这棵树根本没有左叶子!** 但看这个图的左叶子之和是多少? -![图二](https://file.kamacoder.com/pics/20220902165805.png) +![图二](https://file1.kamacoder.com/i/algo/20220902165805.png) 相信通过这两个图,大家对最左叶子的定义有明确理解了。 diff --git "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" old mode 100644 new mode 100755 index 0d060ee837..ce9d3bfb4e --- "a/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" +++ "b/problems/0406.\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227.md" @@ -61,7 +61,7 @@ 以图中{5,2} 为例: -![406.根据身高重建队列](https://file.kamacoder.com/pics/20201216201851982.png) +![406.根据身高重建队列](https://file1.kamacoder.com/i/algo/20201216201851982.png) 按照身高排序之后,优先按身高高的people的k来插入,后序插入节点也不会影响前面已经插入的节点,最终按照k的规则完成了队列。 diff --git "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" old mode 100644 new mode 100755 index 79b4d4f75a..75bc5d0e10 --- "a/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" +++ "b/problems/0416.\345\210\206\345\211\262\347\255\211\345\222\214\345\255\220\351\233\206.md" @@ -155,7 +155,7 @@ dp[j]的数值一定是小于等于j的。 用例1,输入[1,5,11,5] 为例,如图: -![416.分割等和子集2](https://file.kamacoder.com/pics/20210110104240545.png) +![416.分割等和子集2](https://file1.kamacoder.com/i/algo/20210110104240545.png) 最后dp[11] == 11,说明可以将这个数组分割成两个子集,使得两个子集的元素和相等。 diff --git "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" old mode 100644 new mode 100755 index 116cd08e09..c9494313a1 --- "a/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" +++ "b/problems/0417.\345\244\252\345\271\263\346\264\213\345\244\247\350\245\277\346\264\213\346\260\264\346\265\201\351\227\256\351\242\230.md" @@ -18,7 +18,7 @@ 示例 1: -![](https://file.kamacoder.com/pics/20230129103212.png) +![](https://file1.kamacoder.com/i/algo/20230129103212.png) * 输入: heights = [[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]] * 输出: [[0,4],[1,3],[1,4],[2,2],[3,0],[3,1],[4,0]] @@ -130,11 +130,11 @@ public: 从太平洋边上节点出发,如图: -![图一](https://file.kamacoder.com/pics/20220722103029.png) +![图一](https://file1.kamacoder.com/i/algo/20220722103029.png) 从大西洋边上节点出发,如图: -![图二](https://file.kamacoder.com/pics/20220722103330.png) +![图二](https://file1.kamacoder.com/i/algo/20220722103330.png) 按照这样的逻辑,就可以写出如下遍历代码:(详细注释) diff --git "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" old mode 100644 new mode 100755 index 04845ea7c3..4231a8ee90 --- "a/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" +++ "b/problems/0435.\346\227\240\351\207\215\345\217\240\345\214\272\351\227\264.md" @@ -44,7 +44,7 @@ 这里记录非交叉区间的个数还是有技巧的,如图: -![](https://file.kamacoder.com/pics/20230201164134.png) +![](https://file1.kamacoder.com/i/algo/20230201164134.png) 区间,1,2,3,4,5,6都按照右边界排好序。 diff --git "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" old mode 100644 new mode 100755 index 406116a388..44575b8aff --- "a/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" +++ "b/problems/0450.\345\210\240\351\231\244\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\350\212\202\347\202\271.md" @@ -20,7 +20,7 @@ 示例: -![450.删除二叉搜索树中的节点](https://file.kamacoder.com/pics/20201020171048265.png) +![450.删除二叉搜索树中的节点](https://file1.kamacoder.com/i/algo/20201020171048265.png) ## 算法公开课 @@ -67,7 +67,7 @@ if (root == nullptr) return root; 第五种情况有点难以理解,看下面动画: -![450.删除二叉搜索树中的节点](https://code-thinking.cdn.bcebos.com/gifs/450.%E5%88%A0%E9%99%A4%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9.gif) +![450.删除二叉搜索树中的节点](https://file1.kamacoder.com/i/algo/450.%E5%88%A0%E9%99%A4%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E4%B8%AD%E7%9A%84%E8%8A%82%E7%82%B9.gif) 动画中的二叉搜索树中,删除元素7, 那么删除节点(元素7)的左孩子就是5,删除节点(元素7)的右子树的最左面节点是元素8。 diff --git "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" old mode 100644 new mode 100755 index 17d21cd1c4..76de3f93a2 --- "a/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" +++ "b/problems/0452.\347\224\250\346\234\200\345\260\221\346\225\260\351\207\217\347\232\204\347\256\255\345\274\225\347\210\206\346\260\224\347\220\203.md" @@ -76,7 +76,7 @@ 以题目示例: [[10,16],[2,8],[1,6],[7,12]]为例,如图:(方便起见,已经排序) -![452.用最少数量的箭引爆气球](https://file.kamacoder.com/pics/20201123101929791.png) +![452.用最少数量的箭引爆气球](https://file1.kamacoder.com/i/algo/20201123101929791.png) 可以看出首先第一组重叠气球,一定是需要一个箭,气球3,的左边界大于了 第一组重叠气球的最小右边界,所以再需要一支箭来射气球3了。 diff --git "a/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" "b/problems/0454.\345\233\233\346\225\260\347\233\270\345\212\240II.md" old mode 100644 new mode 100755 diff --git "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" old mode 100644 new mode 100755 index 2a6ade1b64..2c38ab9ec1 --- "a/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" +++ "b/problems/0455.\345\210\206\345\217\221\351\245\274\345\271\262.md" @@ -46,7 +46,7 @@ 如图: -![](https://file.kamacoder.com/pics/20230405225628.png) +![](https://file1.kamacoder.com/i/algo/20230405225628.png) 这个例子可以看出饼干 9 只有喂给胃口为 7 的小孩,这样才是整体最优解,并想不出反例,那么就可以撸代码了。 @@ -89,7 +89,7 @@ public: 如果 for 控制的是饼干, if 控制胃口,就是出现如下情况 : -![](https://file.kamacoder.com/pics/20230112102848.png) +![](https://file1.kamacoder.com/i/algo/20230112102848.png) if 里的 index 指向 胃口 10, for 里的 i 指向饼干 9,因为 饼干 9 满足不了 胃口 10,所以 i 持续向前移动,而 index 走不到` s[index] >= g[i]` 的逻辑,所以 index 不会移动,那么当 i 持续向前移动,最后所有的饼干都匹配不上。 diff --git "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 index 627a27a48e..d164277731 --- "a/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0459.\351\207\215\345\244\215\347\232\204\345\255\220\345\255\227\347\254\246\344\270\262.md" @@ -46,13 +46,13 @@ 当一个字符串s:abcabc,内部由重复的子串组成,那么这个字符串的结构一定是这样的: -![图一](https://file.kamacoder.com/pics/20220728104518.png) +![图一](https://file1.kamacoder.com/i/algo/20220728104518.png) 也就是由前后相同的子串组成。 那么既然前面有相同的子串,后面有相同的子串,用 s + s,这样组成的字符串中,后面的子串做前串,前面的子串做后串,就一定还能组成一个s,如图: -![图二](https://file.kamacoder.com/pics/20220728104931.png) +![图二](https://file1.kamacoder.com/i/algo/20220728104931.png) 当然,我们在判断 s + s 拼接的字符串里是否出现一个s的的时候,**要刨除 s + s 的首字符和尾字符**,这样避免在s+s中搜索出原来的s,我们要搜索的是中间拼接出来的s。 @@ -64,11 +64,11 @@ 如图,字符串s,图中数字为数组下标,在 s + s 拼接后, 不算首尾字符,中间凑成s字符串。 (图中数字为数组下标) -![](https://file.kamacoder.com/pics/20240910115555.png) +![](https://file1.kamacoder.com/i/algo/20240910115555.png) 图中,因为中间拼接成了s,根据红色框 可以知道 s[4] = s[0], s[5] = s[1], s[0] = s[2], s[1] = s[3] s[2] = s[4] ,s[3] = s[5] -![](https://file.kamacoder.com/pics/20240910115819.png) +![](https://file1.kamacoder.com/i/algo/20240910115819.png) 以上相等关系我们串联一下: @@ -83,7 +83,7 @@ s[5] = s[1] = s[3] 这里可以有录友想,凭什么就是这样组成的s呢,我换一个方式组成s 行不行,如图: -![](https://file.kamacoder.com/pics/20240910120751.png) +![](https://file1.kamacoder.com/i/algo/20240910120751.png) s[3] = s[0],s[4] = s[1] ,s[5] = s[2],s[0] = s[3],s[1] = s[4],s[2] = s[5] @@ -101,7 +101,7 @@ s[0] s[1] s[2] = s[3] s[4] s[5] 如果是这样的呢,如图: -![](https://file.kamacoder.com/pics/20240910121236.png) +![](https://file1.kamacoder.com/i/algo/20240910121236.png) s[1] = s[0],s[2] = s[1] ,s[3] = s[2],s[4] = s[3],s[5] = s[4],s[0] = s[5] @@ -165,23 +165,23 @@ KMP算法中next数组为什么遇到字符不匹配的时候可以找到上一 那么相同前后缀可以是这样: -![](https://file.kamacoder.com/pics/20240913110257.png) +![](https://file1.kamacoder.com/i/algo/20240913110257.png) 也可以是这样: -![](https://file.kamacoder.com/pics/20240913110316.png) +![](https://file1.kamacoder.com/i/algo/20240913110316.png) 最长的相等前后缀,也就是这样: -![](https://file.kamacoder.com/pics/20240913110841.png) +![](https://file1.kamacoder.com/i/algo/20240913110841.png) 这里有录友就想:如果字符串s 是由最小重复子串p组成,最长相等前后缀就不能更长一些? 例如这样: -![](https://file.kamacoder.com/pics/20240913114348.png) +![](https://file1.kamacoder.com/i/algo/20240913114348.png) 如果这样的话,因为前后缀要相同,所以 p2 = p1,p3 = p2,如图: -![](https://file.kamacoder.com/pics/20240913114818.png) +![](https://file1.kamacoder.com/i/algo/20240913114818.png) p2 = p1,p3 = p2 即: p1 = p2 = p3 @@ -203,7 +203,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 情况一, 最长相等前后缀不包含的子串的长度 比 字符串s的一半的长度还大,那一定不是字符串s的重复子串,如图: -![](https://file.kamacoder.com/pics/20240911110236.png) +![](https://file1.kamacoder.com/i/algo/20240911110236.png) 图中:前后缀不包含的子串的长度 大于 字符串s的长度的 二分之一 @@ -211,7 +211,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 情况二,最长相等前后缀不包含的子串的长度 可以被 字符串s的长度整除,如图: -![](https://file.kamacoder.com/pics/20240910174249.png) +![](https://file1.kamacoder.com/i/algo/20240910174249.png) 步骤一:因为 这是相等的前缀和后缀,t[0] 与 k[0]相同, t[1] 与 k[1]相同,所以 s[0] 一定和 s[2]相同,s[1] 一定和 s[3]相同,即:,s[0]s[1]与s[2]s[3]相同 。 @@ -234,7 +234,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 那么它的最长相同前后缀,就不是上图中的前后缀,而是这样的的前后缀: -![](https://file.kamacoder.com/pics/20240910175053.png) +![](https://file1.kamacoder.com/i/algo/20240910175053.png) 录友可能再问,由一个字符组成的字符串,最长相等前后缀凭什么就是这样的。 @@ -250,7 +250,7 @@ p2 = p1,p3 = p2 即: p1 = p2 = p3 **情况三,最长相等前后缀不包含的子串的长度 不被 字符串s的长度整除得情况**,如图: -![](https://file.kamacoder.com/pics/20240913115854.png) +![](https://file1.kamacoder.com/i/algo/20240913115854.png) 步骤一:因为 这是相等的前缀和后缀,t[0] 与 k[0]相同, t[1] 与 k[1]相同,t[2] 与 k[2]相同。 @@ -301,7 +301,7 @@ next 数组记录的就是最长相同前后缀( [字符串:KMP算法精讲] 如图: -![459.重复的子字符串_1](https://code-thinking.cdn.bcebos.com/pics/459.重复的子字符串_1.png) +![459.重复的子字符串_1](https://file1.kamacoder.com/i/algo/459.重复的子字符串_1.png) `next[len - 1] = 7`,`next[len - 1] + 1 = 8`,8就是此时字符串asdfasdfasdf的最长相同前后缀的长度。 diff --git "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" old mode 100644 new mode 100755 index 40ddc57d63..ba60bc4564 --- "a/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" +++ "b/problems/0463.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" @@ -15,7 +15,7 @@ 岛屿中没有“湖”(“湖” 指水域在岛屿内部且不和岛屿周围的水相连)。格子是边长为 1 的正方形。网格为长方形,且宽度和高度均不超过 100 。计算这个岛屿的周长。 -![](https://file.kamacoder.com/pics/20230829180848.png) +![](https://file1.kamacoder.com/i/algo/20230829180848.png) * 输入:grid = [[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]] * 输出:16 @@ -49,7 +49,7 @@ 如图: - + C++代码如下:(详细注释) @@ -89,7 +89,7 @@ result = 岛屿数量 * 4 - cover * 2; 如图: - + C++代码如下:(详细注释) diff --git "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" old mode 100644 new mode 100755 index 8166b39aad..750917de3e --- "a/problems/0474.\344\270\200\345\222\214\351\233\266.md" +++ "b/problems/0474.\344\270\200\345\222\214\351\233\266.md" @@ -51,7 +51,7 @@ 其实本题并不是多重背包,再来看一下这个图,捋清几种背包的关系 -![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407-20230310132423205.png) +![416.分割等和子集1](https://file1.kamacoder.com/i/algo/20210117171307407-20230310132423205.png) 多重背包是每个物品,数量不同的情况。 @@ -127,7 +127,7 @@ for (string str : strs) { // 遍历物品 最后dp数组的状态如下所示: -![474.一和零](https://file.kamacoder.com/pics/20210120111201512.jpg) +![474.一和零](https://file1.kamacoder.com/i/algo/20210120111201512.jpg) 以上动规五部曲分析完毕,C++代码如下: diff --git "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index b3171c8a12..5d37737169 --- "a/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0491.\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227.md" @@ -45,7 +45,7 @@ 为了有鲜明的对比,我用[4, 7, 6, 7]这个数组来举例,抽象为树形结构如图: -![491. 递增子序列1](https://file.kamacoder.com/pics/20201124200229824.png) +![491. 递增子序列1](https://file1.kamacoder.com/i/algo/20201124200229824.png) @@ -79,7 +79,7 @@ if (path.size() > 1) { * 单层搜索逻辑 -![491. 递增子序列1](https://file.kamacoder.com/pics/20201124200229824-20230310131640070.png) +![491. 递增子序列1](https://file1.kamacoder.com/i/algo/20201124200229824-20230310131640070.png) 在图中可以看出,**同一父节点下的同层上使用过的元素就不能再使用了** 那么单层搜索代码如下: diff --git "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" old mode 100644 new mode 100755 index a23e1743cb..b161bc57a8 --- "a/problems/0494.\347\233\256\346\240\207\345\222\214.md" +++ "b/problems/0494.\347\233\256\346\240\207\345\222\214.md" @@ -163,7 +163,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 先只考虑物品0,如图: -![](https://file.kamacoder.com/pics/20240808161747.png) +![](https://file1.kamacoder.com/i/algo/20240808161747.png) (这里的所有物品,都是题目中的数字1)。 @@ -177,7 +177,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 接下来 考虑 物品0 和 物品1,如图: -![](https://file.kamacoder.com/pics/20240808162052.png) +![](https://file1.kamacoder.com/i/algo/20240808162052.png) 装满背包容量为0 的方法个数是1,即 放0件物品。 @@ -191,7 +191,7 @@ if (abs(target) > sum) return 0; // 此时没有方案 接下来 考虑 物品0 、物品1 和 物品2 ,如图: -![](https://file.kamacoder.com/pics/20240808162533.png) +![](https://file1.kamacoder.com/i/algo/20240808162533.png) 装满背包容量为0 的方法个数是1,即 放0件物品。 @@ -207,17 +207,17 @@ if (abs(target) > sum) return 0; // 此时没有方案 如图红色部分: -![](https://file.kamacoder.com/pics/20240808163312.png) +![](https://file1.kamacoder.com/i/algo/20240808163312.png) dp[2][2] = 3,即 放物品0 和 放物品1、放物品0 和 物品 2、放物品1 和 物品2, 如图所示,三种方法: -![](https://file.kamacoder.com/pics/20240826111946.png) +![](https://file1.kamacoder.com/i/algo/20240826111946.png) **容量为2 的背包,如果不放 物品2 有几种方法呢**? 有 dp[1][2] 种方法,即 背包容量为2,只考虑物品0 和 物品1 ,有 dp[1][2] 种方法,如图: -![](https://file.kamacoder.com/pics/20240826112805.png) +![](https://file1.kamacoder.com/i/algo/20240826112805.png) **容量为2 的背包, 如果放 物品2 有几种方法呢**? @@ -229,7 +229,7 @@ dp[2][2] = 3,即 放物品0 和 放物品1、放物品0 和 物品 2、放物 如图: -![](https://file.kamacoder.com/pics/20240826113043.png) +![](https://file1.kamacoder.com/i/algo/20240826113043.png) 有录友可能疑惑,这里计算的是放满 容量为2的背包 有几种方法,那物品2去哪了? @@ -239,7 +239,7 @@ dp[2][2] = 容量为2的背包不放物品2有几种方法 + 容量为2的背包 所以 dp[2][2] = dp[1][2] + dp[1][1] ,如图: -![](https://file.kamacoder.com/pics/20240826113258.png) +![](https://file1.kamacoder.com/i/algo/20240826113258.png) 以上过程,抽象化如下: @@ -266,11 +266,11 @@ else dp[i][j] = dp[i - 1][j] + dp[i - 1][j - nums[i]]; 先明确递推的方向,如图,求解 dp[2][2] 是由 上方和左上方推出。 -![](https://file.kamacoder.com/pics/20240826115800.png) +![](https://file1.kamacoder.com/i/algo/20240826115800.png) 那么二维数组的最上行 和 最左列一定要初始化,这是递推公式推导的基础,如图红色部分: -![](https://file.kamacoder.com/pics/20240827103507.png) +![](https://file1.kamacoder.com/i/algo/20240827103507.png) 关于dp[0][0]的值,在上面的递推公式讲解中已经讲过,装满背包容量为0 的方法数量是1,即 放0件物品。 @@ -323,7 +323,7 @@ for (int i = 0; i < nums.size(); i++) { 例如下图,如果上方没数值,左上方没数值,就无法推出 dp[2][2]。 -![](https://file.kamacoder.com/pics/20240827105427.png) +![](https://file1.kamacoder.com/i/algo/20240827105427.png) 那么是先 从上到下 ,再从左到右遍历,例如这样: @@ -349,11 +349,11 @@ for (int j = 0; j <= bagSize; j++) { // 列,遍历背包 这里我再画图讲一下,以求dp[2][2]为例,当先从上到下,再从左到右遍历,矩阵是这样: -![](https://file.kamacoder.com/pics/20240827110933.png) +![](https://file1.kamacoder.com/i/algo/20240827110933.png) 当先从左到右,再从上到下遍历,矩阵是这样: -![](https://file.kamacoder.com/pics/20240827111013.png) +![](https://file1.kamacoder.com/i/algo/20240827111013.png) 这里大家可以看出,无论是以上哪种遍历,都不影响 dp[2][2]的求值,用来 推导 dp[2][2] 的数值都在。 @@ -366,7 +366,7 @@ bagSize = (target + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![](https://file.kamacoder.com/pics/20240827111612.png) +![](https://file1.kamacoder.com/i/algo/20240827111612.png) 这么大的矩阵,我们是可以自己手动模拟出来的。 @@ -445,7 +445,7 @@ bagSize = (target + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![](https://file.kamacoder.com/pics/20210125120743274.jpg) +![](https://file1.kamacoder.com/i/algo/20210125120743274.jpg) 大家可以和 二维dp数组的打印结果做一下对比。 diff --git "a/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" "b/problems/0496.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240I.md" old mode 100644 new mode 100755 diff --git "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" old mode 100644 new mode 100755 index 8cca8e65c8..457fd61d24 --- "a/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" +++ "b/problems/0501.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\344\274\227\346\225\260.md" @@ -23,7 +23,7 @@ 给定 BST [1,null,2,2], -![501. 二叉搜索树中的众数](https://file.kamacoder.com/pics/20201014221532206.png) +![501. 二叉搜索树中的众数](https://file1.kamacoder.com/i/algo/20201014221532206.png) 返回[2]. @@ -144,7 +144,7 @@ public: 如图: -![501.二叉搜索树中的众数1](https://file.kamacoder.com/pics/20210204152758889.png) +![501.二叉搜索树中的众数1](https://file1.kamacoder.com/i/algo/20210204152758889.png) 中序遍历代码如下: diff --git "a/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" "b/problems/0503.\344\270\213\344\270\200\344\270\252\346\233\264\345\244\247\345\205\203\347\264\240II.md" old mode 100644 new mode 100755 diff --git "a/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" "b/problems/0509.\346\226\220\346\263\242\351\202\243\345\245\221\346\225\260.md" old mode 100644 new mode 100755 diff --git "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" old mode 100644 new mode 100755 index 4098cb7bfb..03f076a2c9 --- "a/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" +++ "b/problems/0513.\346\211\276\346\240\221\345\267\246\344\270\213\350\247\222\347\232\204\345\200\274.md" @@ -12,11 +12,11 @@ 示例 1: -![513.找树左下角的值](https://file.kamacoder.com/pics/20210204152956836.png) +![513.找树左下角的值](https://file1.kamacoder.com/i/algo/20210204152956836.png) 示例 2: -![513.找树左下角的值1](https://file.kamacoder.com/pics/20210204153017586.png) +![513.找树左下角的值1](https://file1.kamacoder.com/i/algo/20210204153017586.png) ## 算法公开课 diff --git "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index 5e456ac975..882c36bb05 --- "a/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/0516.\346\234\200\351\225\277\345\233\236\346\226\207\345\255\220\345\272\217\345\210\227.md" @@ -56,7 +56,7 @@ 如果s[i]与s[j]相同,那么dp[i][j] = dp[i + 1][j - 1] + 2; 如图: -![516.最长回文子序列](https://file.kamacoder.com/pics/20210127151350563.jpg) +![516.最长回文子序列](https://file1.kamacoder.com/i/algo/20210127151350563.jpg) (如果这里看不懂,回忆一下dp[i][j]的定义) @@ -68,7 +68,7 @@ 那么dp[i][j]一定是取最大的,即:dp[i][j] = max(dp[i + 1][j], dp[i][j - 1]); -![516.最长回文子序列1](https://file.kamacoder.com/pics/20210127151420476.jpg) +![516.最长回文子序列1](https://file1.kamacoder.com/i/algo/20210127151420476.jpg) 代码如下: @@ -97,7 +97,7 @@ for (int i = 0; i < s.size(); i++) dp[i][i] = 1; 从递归公式中,可以看出,dp[i][j] 依赖于 dp[i + 1][j - 1] ,dp[i + 1][j] 和 dp[i][j - 1],如图: -![](https://file.kamacoder.com/pics/20230102172155.png) +![](https://file1.kamacoder.com/i/algo/20230102172155.png) **所以遍历i的时候一定要从下到上遍历,这样才能保证下一行的数据是经过计算的**。 @@ -121,7 +121,7 @@ for (int i = s.size() - 1; i >= 0; i--) { 输入s:"cbbd" 为例,dp数组状态如图: -![516.最长回文子序列3](https://file.kamacoder.com/pics/20210127151521432.jpg) +![516.最长回文子序列3](https://file1.kamacoder.com/i/algo/20210127151521432.jpg) 红色框即:dp[0][s.size() - 1]; 为最终结果。 diff --git "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" old mode 100644 new mode 100755 index 95122a7c95..7e4bbb9a81 --- "a/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" +++ "b/problems/0518.\351\233\266\351\222\261\345\205\221\346\215\242II.md" @@ -136,7 +136,7 @@ 那么二维数组的最上行 和 最左列一定要初始化,这是递推公式推导的基础,如图红色部分: -![](https://file.kamacoder.com/pics/20240827103507.png) +![](https://file1.kamacoder.com/i/algo/20240827103507.png) 这里首先要关注的就是 dp[0][0] 应该是多少? @@ -296,7 +296,7 @@ for (int j = 0; j <= amount; j++) { // 遍历背包容量 输入: amount = 5, coins = [1, 2, 5] ,dp状态图如下: -![518.零钱兑换II](https://file.kamacoder.com/pics/20210120181331461.jpg) +![518.零钱兑换II](https://file1.kamacoder.com/i/algo/20210120181331461.jpg) 最后红色框dp[amount]为最终结果。 diff --git "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" old mode 100644 new mode 100755 index 466bd74479..a8eca862ef --- "a/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" +++ "b/problems/0530.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\347\232\204\346\234\200\345\260\217\347\273\235\345\257\271\345\267\256.md" @@ -13,7 +13,7 @@ 示例: -![530二叉搜索树的最小绝对差](https://file.kamacoder.com/pics/20201014223400123.png) +![530二叉搜索树的最小绝对差](https://file1.kamacoder.com/i/algo/20201014223400123.png) 提示:树中至少有 2 个节点。 @@ -70,7 +70,7 @@ public: 如图: -![530.二叉搜索树的最小绝对差](https://file.kamacoder.com/pics/20210204153247458.png) +![530.二叉搜索树的最小绝对差](https://file1.kamacoder.com/i/algo/20210204153247458.png) 一些同学不知道在递归中如何记录前一个节点的指针,其实实现起来是很简单的,大家只要看过一次,写过一次,就掌握了。 diff --git "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" old mode 100644 new mode 100755 index 45bf1f96ed..c4bfeae4b8 --- "a/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" +++ "b/problems/0538.\346\212\212\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\350\275\254\346\215\242\344\270\272\347\264\257\345\212\240\346\240\221.md" @@ -18,7 +18,7 @@ 示例 1: -![538.把二叉搜索树转换为累加树](https://file.kamacoder.com/pics/20201023160751832.png) +![538.把二叉搜索树转换为累加树](https://file1.kamacoder.com/i/algo/20201023160751832.png) * 输入:[4,1,6,0,2,5,7,null,null,null,3,null,null,null,8] * 输出:[30,36,21,36,35,26,15,null,null,null,33,null,null,null,8] @@ -67,7 +67,7 @@ 遍历顺序如图所示: -![538.把二叉搜索树转换为累加树](https://file.kamacoder.com/pics/20210204153440666.png) +![538.把二叉搜索树转换为累加树](https://file1.kamacoder.com/i/algo/20210204153440666.png) 本题依然需要一个pre指针记录当前遍历节点cur的前一个节点,这样才方便做累加。 diff --git "a/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" "b/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" old mode 100644 new mode 100755 index 2bbe6cffae..d5ad95c112 --- "a/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" +++ "b/problems/0541.\345\217\215\350\275\254\345\255\227\347\254\246\344\270\262II.md" @@ -38,7 +38,7 @@ **所以当需要固定规律一段一段去处理字符串的时候,要想想在for循环的表达式上做做文章。** 性能如下: - + 那么这里具体反转的逻辑我们要不要使用库函数呢,其实用不用都可以,使用reverse来实现反转也没毛病,毕竟不是解题关键部分。 diff --git "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" old mode 100644 new mode 100755 index 7f7d30f6a1..8208d9a1eb --- "a/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" +++ "b/problems/0583.\344\270\244\344\270\252\345\255\227\347\254\246\344\270\262\347\232\204\345\210\240\351\231\244\346\223\215\344\275\234.md" @@ -81,7 +81,7 @@ for (int j = 0; j <= word2.size(); j++) dp[0][j] = j; 以word1:"sea",word2:"eat"为例,推导dp数组状态图如下: -![583.两个字符串的删除操作1](https://file.kamacoder.com/pics/20210714101750205.png) +![583.两个字符串的删除操作1](https://file1.kamacoder.com/i/algo/20210714101750205.png) 以上分析完毕,代码如下: diff --git "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index 755200fe82..3ca5feb9da --- "a/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0617.\345\220\210\345\271\266\344\272\214\345\217\211\346\240\221.md" @@ -13,7 +13,7 @@ 示例 1: -![617.合并二叉树](https://file.kamacoder.com/pics/20230310000854.png) +![617.合并二叉树](https://file1.kamacoder.com/i/algo/20230310000854.png) 注意: 合并必须从两个树的根节点开始。 @@ -38,7 +38,7 @@ 动画如下: -![617.合并二叉树](https://code-thinking.cdn.bcebos.com/gifs/617.%E5%90%88%E5%B9%B6%E4%BA%8C%E5%8F%89%E6%A0%91.gif) +![617.合并二叉树](https://file1.kamacoder.com/i/algo/617.%E5%90%88%E5%B9%B6%E4%BA%8C%E5%8F%89%E6%A0%91.gif) 那么我们来按照递归三部曲来解决: diff --git "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" old mode 100644 new mode 100755 index 7282953570..fd2ae43886 --- "a/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" +++ "b/problems/0647.\345\233\236\346\226\207\345\255\220\344\270\262.md" @@ -48,7 +48,7 @@ dp[i] 和 dp[i-1] ,dp[i + 1] 看上去都没啥关系。 所以我们要看回文串的性质。 如图: -![](https://file.kamacoder.com/pics/20230102170752.png) +![](https://file1.kamacoder.com/i/algo/20230102170752.png) 我们在判断字符串S是否是回文,那么如果我们知道 s[1],s[2],s[3] 这个子串是回文的,那么只需要比较 s[0]和s[4]这两个元素是否相同,如果相同的话,这个字符串s 就是回文串。 @@ -106,7 +106,7 @@ dp[i][j]可以初始化为true么? 当然不行,怎能刚开始就全都匹 dp[i + 1][j - 1] 在 dp[i][j]的左下角,如图: -![647.回文子串](https://file.kamacoder.com/pics/20210121171032473-20230310132134822.jpg) +![647.回文子串](https://file1.kamacoder.com/i/algo/20210121171032473-20230310132134822.jpg) 如果这矩阵是从上到下,从左到右遍历,那么会用到没有计算过的dp[i + 1][j - 1],也就是根据不确定是不是回文的区间[i+1,j-1],来判断了[i,j]是不是回文,那结果一定是不对的。 @@ -136,7 +136,7 @@ for (int i = s.size() - 1; i >= 0; i--) { // 注意遍历顺序 举例,输入:"aaa",dp[i][j]状态如下: -![647.回文子串1](https://file.kamacoder.com/pics/20210121171059951-20230310132153163.jpg) +![647.回文子串1](https://file1.kamacoder.com/i/algo/20210121171059951-20230310132153163.jpg) 图中有6个true,所以就是有6个回文子串。 diff --git "a/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" "b/problems/0649.Dota2\345\217\202\350\256\256\351\231\242.md" old mode 100644 new mode 100755 diff --git "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index b8841a8bea..49ccc9cdea --- "a/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0654.\346\234\200\345\244\247\344\272\214\345\217\211\346\240\221.md" @@ -17,7 +17,7 @@ 示例 : -![654.最大二叉树](https://file.kamacoder.com/pics/20210204154534796.png) +![654.最大二叉树](https://file1.kamacoder.com/i/algo/20210204154534796.png) 提示: @@ -32,7 +32,7 @@ 最大二叉树的构建过程如下: -![654.最大二叉树](https://code-thinking.cdn.bcebos.com/gifs/654.%E6%9C%80%E5%A4%A7%E4%BA%8C%E5%8F%89%E6%A0%91.gif) +![654.最大二叉树](https://file1.kamacoder.com/i/algo/654.%E6%9C%80%E5%A4%A7%E4%BA%8C%E5%8F%89%E6%A0%91.gif) 构造树一般采用的是前序遍历,因为先构造中间节点,然后递归构造左子树和右子树。 diff --git "a/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" "b/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" old mode 100644 new mode 100755 index 89993b6ff6..c1706df4fa --- "a/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" +++ "b/problems/0657.\346\234\272\345\231\250\344\272\272\350\203\275\345\220\246\350\277\224\345\233\236\345\216\237\347\202\271.md" @@ -40,7 +40,7 @@ 最后判断一下x,y是否回到了(0, 0)位置就可以了。 如图所示: - + C++代码如下: diff --git "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" old mode 100644 new mode 100755 index f4ded2c4fb..dbcc6ed63d --- "a/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" +++ "b/problems/0669.\344\277\256\345\211\252\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221.md" @@ -14,9 +14,9 @@ 给定一个二叉搜索树,同时给定最小边界L 和最大边界 R。通过修剪二叉搜索树,使得所有节点的值在[L, R]中 (R>=L) 。你可能需要改变树的根节点,所以结果应当返回修剪好的二叉搜索树的新的根节点。 -![669.修剪二叉搜索树](https://file.kamacoder.com/pics/20201014173115788.png) +![669.修剪二叉搜索树](https://file1.kamacoder.com/i/algo/20201014173115788.png) -![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20201014173219142.png) +![669.修剪二叉搜索树1](https://file1.kamacoder.com/i/algo/20201014173219142.png) ## 算法公开课 @@ -50,7 +50,7 @@ public: 我们在重新关注一下第二个示例,如图: -![669.修剪二叉搜索树](https://file.kamacoder.com/pics/20210204155302751.png) +![669.修剪二叉搜索树](https://file1.kamacoder.com/i/algo/20210204155302751.png) **所以以上的代码是不可行的!** @@ -60,7 +60,7 @@ public: 在上图中我们发现节点0并不符合区间要求,那么将节点0的右孩子 节点2 直接赋给 节点3的左孩子就可以了(就是把节点0从二叉树中移除),如图: -![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20210204155327203.png) +![669.修剪二叉搜索树1](https://file1.kamacoder.com/i/algo/20210204155327203.png) 理解了最关键部分了我们再递归三部曲: @@ -127,7 +127,7 @@ return root; 在回顾一下上面的代码,针对下图中二叉树的情况: -![669.修剪二叉搜索树1](https://file.kamacoder.com/pics/20210204155327203-20230310120126738.png) +![669.修剪二叉搜索树1](https://file1.kamacoder.com/i/algo/20210204155327203-20230310120126738.png) 如下代码相当于把节点0的右孩子(节点2)返回给上一层, diff --git "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" old mode 100644 new mode 100755 index 92009f5b76..9e61229abb --- "a/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" +++ "b/problems/0673.\346\234\200\351\225\277\351\200\222\345\242\236\345\255\220\345\272\217\345\210\227\347\232\204\344\270\252\346\225\260.md" @@ -178,7 +178,7 @@ for (int i = 0; i < nums.size(); i++) { 输入:[1,3,5,4,7] -![673.最长递增子序列的个数](https://file.kamacoder.com/pics/20230310000656.png) +![673.最长递增子序列的个数](https://file1.kamacoder.com/i/algo/20230310000656.png) **如果代码写出来了,怎么改都通过不了,那么把dp和count打印出来看看对不对!** diff --git "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index 16bb2f1887..dae64a11ac --- "a/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" +++ "b/problems/0674.\346\234\200\351\225\277\350\277\236\347\273\255\351\200\222\345\242\236\345\272\217\345\210\227.md" @@ -85,7 +85,7 @@ for (int i = 1; i < nums.size(); i++) { 已输入nums = [1,3,5,4,7]为例,dp数组状态如下: -![674.最长连续递增序列](https://file.kamacoder.com/pics/20210204103529742.jpg) +![674.最长连续递增序列](https://file1.kamacoder.com/i/algo/20210204103529742.jpg) **注意这里要取dp[i]里的最大值,所以dp[2]才是结果!** diff --git "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" old mode 100644 new mode 100755 index 8a7234df52..2f939d0827 --- "a/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" +++ "b/problems/0684.\345\206\227\344\275\231\350\277\236\346\216\245.md" @@ -12,7 +12,7 @@ 请找出一条可以删去的边,删除后可使得剩余部分是一个有着 n 个节点的树。如果有多个答案,则返回数组 edges 中最后出现的边。 -![](https://file.kamacoder.com/pics/20210727150215.png) +![](https://file1.kamacoder.com/i/algo/20210727150215.png) 提示: * n == edges.length @@ -85,7 +85,7 @@ void join(int u, int v) { 如图所示: -![](https://file.kamacoder.com/pics/20230604104720.png) +![](https://file1.kamacoder.com/i/algo/20230604104720.png) 节点A 和节点 B 不在同一个集合,那么就可以将两个 节点连在一起。 @@ -95,7 +95,7 @@ void join(int u, int v) { 如图所示: -![](https://file.kamacoder.com/pics/20230604104330.png) +![](https://file1.kamacoder.com/i/algo/20230604104330.png) 已经判断 节点A 和 节点B 在在同一个集合(同一个根),如果将 节点A 和 节点B 连在一起就一定会出现环。 diff --git "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" old mode 100644 new mode 100755 index 66f7bfe1bc..27161d174c --- "a/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" +++ "b/problems/0685.\345\206\227\344\275\231\350\277\236\346\216\245II.md" @@ -16,9 +16,9 @@ 返回一条能删除的边,使得剩下的图是有 n 个节点的有根树。若有多个答案,返回最后出现在给定二维数组的答案。 -![](https://file.kamacoder.com/pics/20210727151057.png) +![](https://file1.kamacoder.com/i/algo/20210727151057.png) -![](https://file.kamacoder.com/pics/20210727151118.png) +![](https://file1.kamacoder.com/i/algo/20210727151118.png) 提示: @@ -38,7 +38,7 @@ 那么有如下三种情况,前两种情况是出现入度为2的点,如图: - + 且只有一个节点入度为2,为什么不看出度呢,出度没有意义,一棵树中随便一个父节点就有多个出度。 @@ -46,7 +46,7 @@ 如图: - + 首先先计算节点的入度,这里不少录友在计算入度的时候就搞蒙了,分不清 edges[i][j] 表示的都是什么。 diff --git "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" old mode 100644 new mode 100755 index 972a999591..a63d2b0e06 --- "a/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" +++ "b/problems/0695.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" @@ -14,7 +14,7 @@ 计算并返回 grid 中最大的岛屿面积。如果没有岛屿,则返回面积为 0 。 -![](https://file.kamacoder.com/pics/20220729111528.png) +![](https://file1.kamacoder.com/i/algo/20220729111528.png) * 输入:grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]] * 输出:6 @@ -27,7 +27,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题目也是 dfs bfs基础类题目,就是搜索每个岛屿上“1”的数量,然后取一个最大的。 diff --git "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" old mode 100644 new mode 100755 index 0c373f615b..40777a67a2 --- "a/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" +++ "b/problems/0700.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\220\234\347\264\242.md" @@ -12,7 +12,7 @@ 例如, -![700.二叉搜索树中的搜索](https://file.kamacoder.com/pics/20210204155522476.png) +![700.二叉搜索树中的搜索](https://file1.kamacoder.com/i/algo/20210204155522476.png) 在上述示例中,如果要找的值是 5,但因为没有节点值为 5,我们应该返回 NULL。 @@ -124,7 +124,7 @@ public: 中间节点如果大于3就向左走,如果小于3就向右走,如图: -![二叉搜索树](https://file.kamacoder.com/pics/20200812190213280.png) +![二叉搜索树](https://file1.kamacoder.com/i/algo/20200812190213280.png) 所以迭代法代码如下: diff --git "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" old mode 100644 new mode 100755 index 6ce9ef3371..fec287449c --- "a/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" +++ "b/problems/0701.\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\344\270\255\347\232\204\346\217\222\345\205\245\346\223\215\344\275\234.md" @@ -12,7 +12,7 @@ 注意,可能存在多种有效的插入方式,只要树在插入后仍保持为二叉搜索树即可。 你可以返回任意有效的结果。 -![701.二叉搜索树中的插入操作](https://file.kamacoder.com/pics/20201019173259554.png) +![701.二叉搜索树中的插入操作](https://file1.kamacoder.com/i/algo/20201019173259554.png) 提示: @@ -33,7 +33,7 @@ 如下演示视频中可以看出:只要按照二叉搜索树的规则去遍历,遇到空节点就插入节点就可以了。 -![701.二叉搜索树中的插入操作](https://code-thinking.cdn.bcebos.com/gifs/701.%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E4%B8%AD%E7%9A%84%E6%8F%92%E5%85%A5%E6%93%8D%E4%BD%9C.gif) +![701.二叉搜索树中的插入操作](https://file1.kamacoder.com/i/algo/701.%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E4%B8%AD%E7%9A%84%E6%8F%92%E5%85%A5%E6%93%8D%E4%BD%9C.gif) 例如插入元素10 ,需要找到末尾节点插入便可,一样的道理来插入元素15,插入元素0,插入元素6,**需要调整二叉树的结构么? 并不需要。**。 diff --git "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" old mode 100644 new mode 100755 index 0ce2f3b8a6..e529629492 --- "a/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" +++ "b/problems/0704.\344\272\214\345\210\206\346\237\245\346\211\276.md" @@ -59,7 +59,7 @@ 例如在数组:1,2,3,4,7,9,10中查找元素2,如图所示: -![704.二分查找](https://file.kamacoder.com/pics/20210311153055723.jpg) +![704.二分查找](https://file1.kamacoder.com/i/algo/20210311153055723.jpg) 代码如下:(详细注释) @@ -102,7 +102,7 @@ public: 在数组:1,2,3,4,7,9,10中查找元素2,如图所示:(**注意和方法一的区别**) -![704.二分查找1](https://file.kamacoder.com/pics/20210311153123632.jpg) +![704.二分查找1](https://file1.kamacoder.com/i/algo/20210311153123632.jpg) 代码如下:(详细注释) diff --git "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" old mode 100644 new mode 100755 index a2b2803b11..72e35f430f --- "a/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" +++ "b/problems/0707.\350\256\276\350\256\241\351\223\276\350\241\250.md" @@ -20,7 +20,7 @@ * deleteAtIndex(index):如果索引 index 有效,则删除链表中的第 index 个节点。 -![707示例](https://file.kamacoder.com/pics/20200814200558953.png) +![707示例](https://file1.kamacoder.com/i/algo/20200814200558953.png) ## 算法公开课 @@ -35,10 +35,10 @@ 如果对链表的虚拟头结点不清楚,可以看这篇文章:[链表:听说用虚拟头节点会方便很多?](https://programmercarl.com/0203.移除链表元素.html) 删除链表节点: -![链表-删除节点](https://file.kamacoder.com/pics/20200806195114541.png) +![链表-删除节点](https://file1.kamacoder.com/i/algo/20200806195114541.png) 添加链表节点: -![链表-添加节点](https://file.kamacoder.com/pics/20200806195134331.png) +![链表-添加节点](https://file1.kamacoder.com/i/algo/20200806195134331.png) 这道题目设计链表的五个接口: * 获取链表第index个节点的数值 diff --git "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271.md" old mode 100644 new mode 100755 diff --git "a/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" "b/problems/0714.\344\271\260\345\215\226\350\202\241\347\245\250\347\232\204\346\234\200\344\275\263\346\227\266\346\234\272\345\220\253\346\211\213\347\273\255\350\264\271\357\274\210\345\212\250\346\200\201\350\247\204\345\210\222\357\274\211.md" old mode 100644 new mode 100755 diff --git "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" old mode 100644 new mode 100755 index b371bd857b..12384a57a7 --- "a/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" +++ "b/problems/0718.\346\234\200\351\225\277\351\207\215\345\244\215\345\255\220\346\225\260\347\273\204.md" @@ -95,7 +95,7 @@ for (int i = 1; i <= nums1.size(); i++) { 拿示例1中,A: [1,2,3,2,1],B: [3,2,1,4,7]为例,画一个dp数组的状态变化,如下: -![718.最长重复子数组](https://file.kamacoder.com/pics/2021011215282060.jpg) +![718.最长重复子数组](https://file1.kamacoder.com/i/algo/2021011215282060.jpg) 以上五部曲分析完毕,C++代码如下: @@ -127,7 +127,7 @@ public: 在如下图中: -![718.最长重复子数组](https://file.kamacoder.com/pics/2021011215282060-20230310134554486.jpg) +![718.最长重复子数组](https://file1.kamacoder.com/i/algo/2021011215282060-20230310134554486.jpg) 我们可以看出dp[i][j]都是由dp[i - 1][j - 1]推出。那么压缩为一维数组,也就是dp[j]都是由dp[j - 1]推出。 diff --git "a/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" "b/problems/0724.\345\257\273\346\211\276\346\225\260\347\273\204\347\232\204\344\270\255\345\277\203\347\264\242\345\274\225.md" old mode 100644 new mode 100755 diff --git "a/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" "b/problems/0738.\345\215\225\350\260\203\351\200\222\345\242\236\347\232\204\346\225\260\345\255\227.md" old mode 100644 new mode 100755 diff --git "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" old mode 100644 new mode 100755 index ed43cf141f..2ad7e6b79b --- "a/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" +++ "b/problems/0739.\346\257\217\346\227\245\346\270\251\345\272\246.md" @@ -69,7 +69,7 @@ 首先先将第一个遍历元素加入单调栈 -![739.每日温度1](https://file.kamacoder.com/pics/20210219124434172.jpg) +![739.每日温度1](https://file1.kamacoder.com/i/algo/20210219124434172.jpg) --------- @@ -77,65 +77,65 @@ 我们要保持一个递增单调栈(从栈头到栈底),所以将T[0]弹出,T[1]加入,此时result数组可以记录了,result[0] = 1,即T[0]右面第一个比T[0]大的元素是T[1]。 -![739.每日温度2](https://file.kamacoder.com/pics/20210219124504299.jpg) +![739.每日温度2](https://file1.kamacoder.com/i/algo/20210219124504299.jpg) ----------- 加入T[2],同理,T[1]弹出 -![739.每日温度3](https://file.kamacoder.com/pics/20210219124527361.jpg) +![739.每日温度3](https://file1.kamacoder.com/i/algo/20210219124527361.jpg) ------- 加入T[3],T[3] < T[2] (当前遍历的元素T[i]小于栈顶元素T[st.top()]的情况),加T[3]加入单调栈。 -![739.每日温度4](https://file.kamacoder.com/pics/20210219124610761.jpg) +![739.每日温度4](https://file1.kamacoder.com/i/algo/20210219124610761.jpg) --------- 加入T[4],T[4] == T[3] (当前遍历的元素T[i]等于栈顶元素T[st.top()]的情况),此时依然要加入栈,不用计算距离,因为我们要求的是右面第一个大于本元素的位置,而不是大于等于! -![739.每日温度5](https://file.kamacoder.com/pics/20210219124633444.jpg) +![739.每日温度5](https://file1.kamacoder.com/i/algo/20210219124633444.jpg) --------- 加入T[5],T[5] > T[4] (当前遍历的元素T[i]大于栈顶元素T[st.top()]的情况),将T[4]弹出,同时计算距离,更新result -![739.每日温度6](https://file.kamacoder.com/pics/20210219124700567.jpg) +![739.每日温度6](https://file1.kamacoder.com/i/algo/20210219124700567.jpg) ---------- T[4]弹出之后, T[5] > T[3] (当前遍历的元素T[i]大于栈顶元素T[st.top()]的情况),将T[3]继续弹出,同时计算距离,更新result -![739.每日温度7](https://file.kamacoder.com/pics/20210219124726613.jpg) +![739.每日温度7](https://file1.kamacoder.com/i/algo/20210219124726613.jpg) ------- 直到发现T[5]小于T[st.top()],终止弹出,将T[5]加入单调栈 -![739.每日温度8](https://file.kamacoder.com/pics/20210219124807715.jpg) +![739.每日温度8](https://file1.kamacoder.com/i/algo/20210219124807715.jpg) ------- 加入T[6],同理,需要将栈里的T[5],T[2]弹出 -![739.每日温度9](https://file.kamacoder.com/pics/2021021912483374.jpg) +![739.每日温度9](https://file1.kamacoder.com/i/algo/2021021912483374.jpg) ------- 同理,继续弹出 -![739.每日温度10](https://file.kamacoder.com/pics/2021021912490098.jpg) +![739.每日温度10](https://file1.kamacoder.com/i/algo/2021021912490098.jpg) ------ 此时栈里只剩下了T[6] -![739.每日温度11](https://file.kamacoder.com/pics/20210219124930156.jpg) +![739.每日温度11](https://file1.kamacoder.com/i/algo/20210219124930156.jpg) ------------ 加入T[7], T[7] < T[6] 直接入栈,这就是最后的情况,result数组也更新完了。 -![739.每日温度12](https://file.kamacoder.com/pics/20210219124957216.jpg) +![739.每日温度12](https://file1.kamacoder.com/i/algo/20210219124957216.jpg) 此时有同学可能就疑惑了,那result[6] , result[7]怎么没更新啊,元素也一直在栈里。 diff --git "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" index c8a8736151..40b699c18f 100644 --- "a/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" +++ "b/problems/0743.\347\275\221\347\273\234\345\273\266\350\277\237\346\227\266\351\227\264.md" @@ -13,7 +13,7 @@ https://leetcode.cn/problems/network-delay-time/description/ 现在,从某个节点 K 发出一个信号。需要多久才能使所有节点都收到信号?如果不能使所有节点收到信号,返回 -1 。 -![](https://file.kamacoder.com/pics/20240229104105.png) +![](https://file1.kamacoder.com/i/algo/20240229104105.png) 提示: @@ -42,7 +42,7 @@ dijkstra算法:在有权图(权值非负数)中求从起点到其他节点 如本题示例中的图: -![](https://file.kamacoder.com/pics/20240125162647.png) +![](https://file1.kamacoder.com/i/algo/20240125162647.png) 起点(节点1)到终点(节点7) 的最短路径是 图中 标记绿线的部分。 @@ -88,7 +88,7 @@ minDist数组数值初始化为int最大值。 这里在强点一下 **minDist数组的含义:记录所有节点到源点的最短路径**,那么初始化的时候就应该初始为最大值,这样才能在后续出现最短路径的时候及时更新。 -![](https://file.kamacoder.com/pics/20240130115306.png) +![](https://file1.kamacoder.com/i/algo/20240130115306.png) (图中,max 表示默认值,节点0 不做处理,统一从下标1 开始计算,这样下标和节点数值统一, 方便大家理解,避免搞混) @@ -110,7 +110,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130115421.png) +![](https://file1.kamacoder.com/i/algo/20240130115421.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -136,7 +136,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130121240.png) +![](https://file1.kamacoder.com/i/algo/20240130121240.png) 更新 minDist数组,即:源点(节点1) 到 节点6 、 节点3 和 节点4的距离。 @@ -170,7 +170,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130120434.png) +![](https://file1.kamacoder.com/i/algo/20240130120434.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -190,7 +190,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201105335.png) +![](https://file1.kamacoder.com/i/algo/20240201105335.png) 由于节点4的加入,那么源点可以链接到节点5 所以更新minDist数组: @@ -210,7 +210,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110250.png) +![](https://file1.kamacoder.com/i/algo/20240201110250.png) 由于节点6的加入,那么源点可以链接到节点7 所以 更新minDist数组: @@ -230,7 +230,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110651.png) +![](https://file1.kamacoder.com/i/algo/20240201110651.png) 由于节点5的加入,那么源点有新的路径可以链接到节点7 所以 更新minDist数组: @@ -248,7 +248,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110920.png) +![](https://file1.kamacoder.com/i/algo/20240201110920.png) 节点7加入,但节点7到节点7的距离为0,所以 不用更新minDist数组 @@ -262,7 +262,7 @@ minDist数组数值初始化为int最大值。 路径如图: -![](https://file.kamacoder.com/pics/20240201111352.png) +![](https://file1.kamacoder.com/i/algo/20240201111352.png) 在上面的讲解中,每一步 我都是按照 dijkstra 三部曲来讲解的,理解了这三部曲,代码也就好懂的。 @@ -431,7 +431,7 @@ select:4 看一下这个图: (有负权值) -![](https://file.kamacoder.com/pics/20240227104334.png) +![](https://file1.kamacoder.com/i/algo/20240227104334.png) 节点1 到 节点5 的最短路径 应该是 节点1 -> 节点2 -> 节点3 -> 节点4 -> 节点5 @@ -441,7 +441,7 @@ select:4 初始化: -![](https://file.kamacoder.com/pics/20240227104801.png) +![](https://file1.kamacoder.com/i/algo/20240227104801.png) --------------- @@ -455,7 +455,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110217.png) +![](https://file1.kamacoder.com/i/algo/20240227110217.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -474,7 +474,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110330.png) +![](https://file1.kamacoder.com/i/algo/20240227110330.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -492,7 +492,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110346.png) +![](https://file1.kamacoder.com/i/algo/20240227110346.png) 由于节点4的加入,那么源点可以有新的路径链接到节点5 所以更新minDist数组: @@ -510,7 +510,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110405.png) +![](https://file1.kamacoder.com/i/algo/20240227110405.png) 节点5的加入,而节点5 没有链接其他节点, 所以不用更新minDist数组,仅标记节点5被访问过了 @@ -526,7 +526,7 @@ select:4 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110711.png) +![](https://file1.kamacoder.com/i/algo/20240227110711.png) -------------- @@ -654,7 +654,7 @@ for (int v = 1; v <= n; v++) { 如图: -![](https://file.kamacoder.com/pics/20240222110025.png) +![](https://file1.kamacoder.com/i/algo/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间,有一条双向边,即:grid[2][5] = 6,grid[5][2] = 6 @@ -678,7 +678,7 @@ for (int v = 1; v <= n; v++) { 邻接表的构造如图: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 这里表达的图是: @@ -763,7 +763,7 @@ vector> grid(n + 1); 不少录友,不知道 如何定义的数据结构,怎么表示邻接表的,我来给大家画一个图: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 图中邻接表表示: @@ -784,7 +784,7 @@ vector>> grid(n + 1); 举例来给大家展示 该代码表达的数据 如下: -![](https://file.kamacoder.com/pics/20240223103904.png) +![](https://file1.kamacoder.com/i/algo/20240223103904.png) * 节点1 指向 节点3 权值为 1 * 节点1 指向 节点5 权值为 2 @@ -907,7 +907,7 @@ for (int v = 1; v <= n; v++) { 再回顾一下邻接表的构造(数组 + 链表): -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 假如 加入的cur 是节点 2, 那么 grid[2] 表示的就是图中第二行链表。 (grid数组的构造我们在 上面 「图的存储」中讲过) diff --git "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" old mode 100644 new mode 100755 index 147c7bfba7..952d4d2ab7 --- "a/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" +++ "b/problems/0746.\344\275\277\347\224\250\346\234\200\345\260\217\350\212\261\350\264\271\347\210\254\346\245\274\346\242\257.md" @@ -52,7 +52,7 @@ 请你计算并返回达到楼梯顶部的最低花费。 -![](https://file.kamacoder.com/pics/20221031170131.png) +![](https://file1.kamacoder.com/i/algo/20221031170131.png) ## 思路 @@ -112,7 +112,7 @@ dp[i - 2] 跳到 dp[i] 需要花费 dp[i - 2] + cost[i - 2]。 拿示例2:cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1] ,来模拟一下dp数组的状态变化,如下: -![](https://file.kamacoder.com/pics/20221026175104.png) +![](https://file1.kamacoder.com/i/algo/20221026175104.png) 如果大家代码写出来有问题,就把dp数组打印出来,看看和如上推导的是不是一样的。 diff --git "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" old mode 100644 new mode 100755 index daf52bea55..d17878381f --- "a/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" +++ "b/problems/0763.\345\210\222\345\210\206\345\255\227\346\257\215\345\214\272\351\227\264.md" @@ -44,7 +44,7 @@ 如图: -![763.划分字母区间](https://file.kamacoder.com/pics/20201222191924417.png) +![763.划分字母区间](https://file1.kamacoder.com/i/algo/20201222191924417.png) 明白原理之后,代码并不复杂,如下: diff --git "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" index 6133ac7733..fb58c14816 100644 --- "a/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" +++ "b/problems/0787.K\347\253\231\344\270\255\350\275\254\345\206\205\346\234\200\344\276\277\345\256\234\347\232\204\350\210\252\347\217\255.md" @@ -9,11 +9,11 @@ 现在给定所有的城市和航班,以及出发城市 src 和目的地 dst,你的任务是找到出一条最多经过 k 站中转的路线,使得从 src 到 dst 的 价格最便宜 ,并返回该价格。 如果不存在这样的路线,则输出 -1。 -![](https://file.kamacoder.com/pics/20240319103900.png) +![](https://file1.kamacoder.com/i/algo/20240319103900.png) -![](https://file.kamacoder.com/pics/20240319103919.png) +![](https://file1.kamacoder.com/i/algo/20240319103919.png) -![](https://file.kamacoder.com/pics/20240319104026.png) +![](https://file1.kamacoder.com/i/algo/20240319104026.png) ## 思路 diff --git "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" old mode 100644 new mode 100755 index 639b6b2b3b..db4d249a15 --- "a/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" +++ "b/problems/0797.\346\211\200\346\234\211\345\217\257\350\203\275\347\232\204\350\267\257\345\276\204.md" @@ -11,7 +11,7 @@ graph[i] 是一个从节点 i 可以访问的所有节点的列表(即从节点 i 到节点 graph[i][j]存在一条有向边)。 -![](https://file.kamacoder.com/pics/20221203135439.png) +![](https://file1.kamacoder.com/i/algo/20221203135439.png) 提示: @@ -96,7 +96,7 @@ path.push_back(graph[x][i]); // 遍历到的节点加入到路径中来 一些录友可以疑惑这里如果找到x 链接的节点的,例如如果x目前是节点0,那么目前的过程就是这样的: -![](https://file.kamacoder.com/pics/20221204111937.png) +![](https://file1.kamacoder.com/i/algo/20221204111937.png) 二维数组中,graph[x][i] 都是x链接的节点,当前遍历的节点就是 `graph[x][i]` 。 diff --git "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" old mode 100644 new mode 100755 index e6aa4601dd..118735e943 --- "a/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" +++ "b/problems/0827.\346\234\200\345\244\247\344\272\272\345\267\245\345\262\233.md" @@ -51,11 +51,11 @@ 拿如下地图的岛屿情况来举例: (1为陆地) -![](https://file.kamacoder.com/pics/20220829104834.png) +![](https://file1.kamacoder.com/i/algo/20220829104834.png) 第一步,则遍历题目,并将岛屿到编号和面积上的统计,过程如图所示: -![](https://file.kamacoder.com/pics/20220829105644.png) +![](https://file1.kamacoder.com/i/algo/20220829105644.png) 本过程代码如下: @@ -102,7 +102,7 @@ int largestIsland(vector>& grid) { 第二步过程如图所示: -![](https://file.kamacoder.com/pics/20220829105249.png) +![](https://file1.kamacoder.com/i/algo/20220829105249.png) 也就是遍历每一个0的方格,并统计其相邻岛屿面积,最后取一个最大值。 diff --git "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" old mode 100644 new mode 100755 index 60180d2736..ffcf2fb919 --- "a/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" +++ "b/problems/0841.\351\222\245\345\214\231\345\222\214\346\210\277\351\227\264.md" @@ -35,7 +35,7 @@ 图中给我的两个示例: `[[1],[2],[3],[]]` `[[1,3],[3,0,1],[2],[0]]`,画成对应的图如下: -![](https://file.kamacoder.com/pics/20220714101414.png) +![](https://file1.kamacoder.com/i/algo/20220714101414.png) 我们可以看出图1的所有节点都是链接的,而图二中,节点2 是孤立的。 @@ -48,7 +48,7 @@ 图3:[[5], [], [1, 3], [5]] ,如图: -![](https://file.kamacoder.com/pics/20220714102201.png) +![](https://file1.kamacoder.com/i/algo/20220714102201.png) 在图3中,大家可以发现,节点0只能到节点5,然后就哪也去不了了。 diff --git "a/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" "b/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 index f229447384..6d0cd68578 --- "a/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/0844.\346\257\224\350\276\203\345\220\253\351\200\200\346\240\274\347\232\204\345\255\227\347\254\246\344\270\262.md" @@ -106,7 +106,7 @@ public: 动画如下: - + 如果S[i]和S[j]不相同返回false,如果有一个指针(i或者j)先走到的字符串头部位置,也返回false。 diff --git "a/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" "b/problems/0860.\346\237\240\346\252\254\346\260\264\346\211\276\351\233\266.md" old mode 100644 new mode 100755 diff --git "a/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" "b/problems/0922.\346\214\211\345\245\207\345\201\266\346\216\222\345\272\217\346\225\260\347\273\204II.md" old mode 100644 new mode 100755 diff --git "a/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" "b/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" old mode 100644 new mode 100755 index 47465199a8..f653caef52 --- "a/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" +++ "b/problems/0925.\351\225\277\346\214\211\351\224\256\345\205\245.md" @@ -52,7 +52,7 @@ 动画如下: - + 上面的逻辑想清楚了,不难写出如下C++代码: diff --git "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" old mode 100644 new mode 100755 index d4165f3672..9f000e2bb5 --- "a/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" +++ "b/problems/0941.\346\234\211\346\225\210\347\232\204\345\261\261\350\204\211\346\225\260\347\273\204.md" @@ -16,7 +16,7 @@ * arr[0] < arr[1] < ... arr[i-1] < arr[i] * arr[i] > arr[i+1] > ... > arr[arr.length - 1] -![](https://file.kamacoder.com/pics/20210729103604.png) +![](https://file1.kamacoder.com/i/algo/20210729103604.png) 示例 1: * 输入:arr = [2,1] @@ -37,7 +37,7 @@ 这样可以使用两个指针,left和right,让其按照如下规则移动,如图: - + **注意这里还是有一些细节,例如如下两点:** diff --git "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" old mode 100644 new mode 100755 index d8c31ca998..989993acf5 --- "a/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/0968.\347\233\221\346\216\247\344\272\214\345\217\211\346\240\221.md" @@ -17,7 +17,7 @@ 示例 1: -![](https://file.kamacoder.com/pics/20201229175736596.png) +![](https://file1.kamacoder.com/i/algo/20201229175736596.png) * 输入:[0,0,null,0,0] * 输出:1 @@ -25,7 +25,7 @@ 示例 2: -![](https://file.kamacoder.com/pics/2020122917584449.png) +![](https://file1.kamacoder.com/i/algo/2020122917584449.png) * 输入:[0,0,null,0,null,0,null,null,0] * 输出:2 @@ -143,7 +143,7 @@ if (cur == NULL) return 2; 如图: -![968.监控二叉树2](https://file.kamacoder.com/pics/20201229203710729.png) +![968.监控二叉树2](https://file1.kamacoder.com/i/algo/20201229203710729.png) 代码如下: @@ -191,7 +191,7 @@ if (left == 1 || right == 1) return 2; **从这个代码中,可以看出,如果left == 1, right == 0 怎么办?其实这种条件在情况2中已经判断过了**,如图: -![968.监控二叉树1](https://file.kamacoder.com/pics/2020122920362355.png) +![968.监控二叉树1](https://file1.kamacoder.com/i/algo/2020122920362355.png) 这种情况也是大多数同学容易迷惑的情况。 @@ -199,7 +199,7 @@ if (left == 1 || right == 1) return 2; 以上都处理完了,递归结束之后,可能头结点 还有一个无覆盖的情况,如图: -![968.监控二叉树3](https://file.kamacoder.com/pics/20201229203742446.png) +![968.监控二叉树3](https://file1.kamacoder.com/i/algo/20201229203742446.png) 所以递归结束之后,还要判断根节点,如果没有覆盖,result++,代码如下: diff --git "a/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" "b/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" old mode 100644 new mode 100755 index 6e58be1af6..1f58fd5198 --- "a/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" +++ "b/problems/0977.\346\234\211\345\272\217\346\225\260\347\273\204\347\232\204\345\271\263\346\226\271.md" @@ -61,7 +61,7 @@ public: 如动画所示: -![](https://code-thinking.cdn.bcebos.com/gifs/977.有序数组的平方.gif) +![](https://file1.kamacoder.com/i/algo/977.有序数组的平方.gif) 不难写出如下代码: diff --git "a/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" "b/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" old mode 100644 new mode 100755 index 3d7d8e0770..cbf5ecdb78 --- "a/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" +++ "b/problems/1002.\346\237\245\346\211\276\345\270\270\347\224\250\345\255\227\347\254\246.md" @@ -53,7 +53,7 @@ words[i] 由小写英文字母组成 如图: -![1002.查找常用字符](https://code-thinking.cdn.bcebos.com/pics/1002.查找常用字符.png) +![1002.查找常用字符](https://file1.kamacoder.com/i/algo/1002.查找常用字符.png) 先统计第一个字符串所有字符出现的次数,代码如下: diff --git "a/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" "b/problems/1005.K\346\254\241\345\217\226\345\217\215\345\220\216\346\234\200\345\244\247\345\214\226\347\232\204\346\225\260\347\273\204\345\222\214.md" old mode 100644 new mode 100755 diff --git "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" old mode 100644 new mode 100755 index ae6b3895fa..396e6c566b --- "a/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" +++ "b/problems/1020.\351\243\236\345\234\260\347\232\204\346\225\260\351\207\217.md" @@ -12,13 +12,13 @@ 返回网格中 无法 在任意次数的移动中离开网格边界的陆地单元格的数量。 -![](https://file.kamacoder.com/pics/20220830100710.png) +![](https://file1.kamacoder.com/i/algo/20220830100710.png) * 输入:grid = [[0,0,0,0],[1,0,1,0],[0,1,1,0],[0,0,0,0]] * 输出:3 * 解释:有三个 1 被 0 包围。一个 1 没有被包围,因为它在边界上。 -![](https://file.kamacoder.com/pics/20220830100742.png) +![](https://file1.kamacoder.com/i/algo/20220830100742.png) * 输入:grid = [[0,1,1,0],[0,0,1,0],[0,0,1,0],[0,0,0,0]] * 输出:0 @@ -32,11 +32,11 @@ 如图,在遍历地图周围四个边,靠地图四边的陆地,都为绿色, -![](https://file.kamacoder.com/pics/20220830104632.png) +![](https://file1.kamacoder.com/i/algo/20220830104632.png) 在遇到地图周边陆地的时候,将1都变为0,此时地图为这样: -![](https://file.kamacoder.com/pics/20220830104651.png) +![](https://file1.kamacoder.com/i/algo/20220830104651.png) 然后我们再去遍历这个地图,遇到有陆地的地方,去采用深搜或者广搜,边统计所有陆地。 diff --git "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" old mode 100644 new mode 100755 index 0119df82ea..16bf869ea6 --- "a/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" +++ "b/problems/1035.\344\270\215\347\233\270\344\272\244\347\232\204\347\272\277.md" @@ -18,7 +18,7 @@ 以这种方法绘制线条,并返回可以绘制的最大连线数。 -![1035.不相交的线](https://file.kamacoder.com/pics/2021032116363533.png) +![1035.不相交的线](https://file1.kamacoder.com/i/algo/2021032116363533.png) ## 算法公开课 @@ -36,7 +36,7 @@ 拿示例一nums1 = [1,4,2], nums2 = [1,2,4]为例,相交情况如图: -![](https://file.kamacoder.com/pics/20210914145158.png) +![](https://file1.kamacoder.com/i/algo/20210914145158.png) 其实也就是说nums1和nums2的最长公共子序列是[1,4],长度为2。 这个公共子序列指的是相对顺序不变(即数字4在字符串nums1中数字1的后面,那么数字4也应该在字符串nums2数字1的后面) diff --git "a/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" "b/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" old mode 100644 new mode 100755 index 01d33fbff7..36702194be --- "a/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" +++ "b/problems/1047.\345\210\240\351\231\244\345\255\227\347\254\246\344\270\262\344\270\255\347\232\204\346\211\200\346\234\211\347\233\270\351\202\273\351\207\215\345\244\215\351\241\271.md" @@ -46,7 +46,7 @@ 然后再去做对应的消除操作。 如动画所示: -![1047.删除字符串中的所有相邻重复项](https://code-thinking.cdn.bcebos.com/gifs/1047.删除字符串中的所有相邻重复项.gif) +![1047.删除字符串中的所有相邻重复项](https://file1.kamacoder.com/i/algo/1047.删除字符串中的所有相邻重复项.gif) 从栈中弹出剩余元素,此时是字符串ac,因为从栈里弹出的元素是倒序的,所以再对字符串进行反转一下,就得到了最终的结果。 diff --git "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" old mode 100644 new mode 100755 index 6dfba4ed44..ddc9f313db --- "a/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" +++ "b/problems/1049.\346\234\200\345\220\216\344\270\200\345\235\227\347\237\263\345\244\264\347\232\204\351\207\215\351\207\217II.md" @@ -114,7 +114,7 @@ for (int i = 0; i < stones.size(); i++) { // 遍历物品 举例,输入:[2,4,1,1],此时target = (2 + 4 + 1 + 1)/2 = 4 ,dp数组状态图如下: -![1049.最后一块石头的重量II](https://file.kamacoder.com/pics/20210121115805904.jpg) +![1049.最后一块石头的重量II](https://file1.kamacoder.com/i/algo/20210121115805904.jpg) 最后dp[target]里是容量为target的背包所能背的最大重量。 diff --git "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" old mode 100644 new mode 100755 index 91c29b8313..424f403938 --- "a/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" +++ "b/problems/1143.\346\234\200\351\225\277\345\205\254\345\205\261\345\255\220\345\272\217\345\210\227.md" @@ -94,7 +94,7 @@ vector> dp(text1.size() + 1, vector(text2.size() + 1, 0)); 从递推公式,可以看出,有三个方向可以推出dp[i][j],如图: -![1143.最长公共子序列](https://file.kamacoder.com/pics/20210204115139616.jpg) +![1143.最长公共子序列](https://file1.kamacoder.com/i/algo/20210204115139616.jpg) 那么为了在递推的过程中,这三个方向都是经过计算的数值,所以要从前向后,从上到下来遍历这个矩阵。 @@ -103,7 +103,7 @@ vector> dp(text1.size() + 1, vector(text2.size() + 1, 0)); 以输入:text1 = "abcde", text2 = "ace" 为例,dp状态如图: -![1143.最长公共子序列1](https://file.kamacoder.com/pics/20210210150215918.jpg) +![1143.最长公共子序列1](https://file1.kamacoder.com/i/algo/20210210150215918.jpg) 最后红框dp[text1.size()][text2.size()]为最终结果 diff --git "a/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" "b/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" old mode 100644 new mode 100755 index fbb19af773..72462f1119 --- "a/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" +++ "b/problems/1207.\347\213\254\344\270\200\346\227\240\344\272\214\347\232\204\345\207\272\347\216\260\346\254\241\346\225\260.md" @@ -45,7 +45,7 @@ 如图所示: - + C++代码如下: diff --git "a/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" "b/problems/1221.\345\210\206\345\211\262\345\271\263\350\241\241\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 diff --git "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" old mode 100644 new mode 100755 index ebea30e34f..b440c32648 --- "a/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" +++ "b/problems/1254.\347\273\237\350\256\241\345\260\201\351\227\255\345\262\233\345\261\277\347\232\204\346\225\260\347\233\256.md" @@ -10,13 +10,13 @@ 请返回 封闭岛屿 的数目。 -![](https://file.kamacoder.com/pics/20220830111533.png) +![](https://file1.kamacoder.com/i/algo/20220830111533.png) * 输入:grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]] * 输出:2 * 解释:灰色区域的岛屿是封闭岛屿,因为这座岛屿完全被水域包围(即被 1 区域包围)。 -![](https://file.kamacoder.com/pics/20220830111601.png) +![](https://file1.kamacoder.com/i/algo/20220830111601.png) * 输入:grid = [[0,0,1,0,0],[0,1,0,1,0],[0,1,1,1,0]] * 输出:1 diff --git "a/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" "b/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" old mode 100644 new mode 100755 index 0ae1603494..11f947a184 --- "a/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" +++ "b/problems/1356.\346\240\271\346\215\256\346\225\260\345\255\227\344\272\214\350\277\233\345\210\266\344\270\2131\347\232\204\346\225\260\347\233\256\346\216\222\345\272\217.md" @@ -81,7 +81,7 @@ int bitCount(int n) { ``` 以计算12的二进制1的数量为例,如图所示: - + 下面我就使用方法二,来做这道题目: diff --git "a/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" "b/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" old mode 100644 new mode 100755 index 2cb73f728a..61b548abf8 --- "a/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" +++ "b/problems/1365.\346\234\211\345\244\232\345\260\221\345\260\217\344\272\216\345\275\223\345\211\215\346\225\260\345\255\227\347\232\204\346\225\260\345\255\227.md" @@ -85,7 +85,7 @@ for (int i = 0; i < nums.size(); i++) { 流程如图: - + 关键地方讲完了,整体C++代码如下: diff --git "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" old mode 100644 new mode 100755 index 7b0d32048a..551766ff0d --- "a/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" +++ "b/problems/1382.\345\260\206\344\272\214\345\217\211\346\220\234\347\264\242\346\240\221\345\217\230\345\271\263\350\241\241.md" @@ -15,7 +15,7 @@ 示例: -![](https://file.kamacoder.com/pics/20210726154512.png) +![](https://file1.kamacoder.com/i/algo/20210726154512.png) * 输入:root = [1,null,2,null,3,null,4,null,null] * 输出:[2,1,3,null,null,null,4] diff --git "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" old mode 100644 new mode 100755 index 5dd56c65d9..9991249f5a --- "a/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" +++ "b/problems/1791.\346\211\276\345\207\272\346\230\237\345\236\213\345\233\276\347\232\204\344\270\255\345\277\203\350\212\202\347\202\271.md" @@ -10,7 +10,7 @@ 什么是度,可以理解为,链接节点的边的数量。 题目中度如图所示: -![1791.找出星型图的中心节点](https://file.kamacoder.com/pics/20220704113207.png) +![1791.找出星型图的中心节点](https://file1.kamacoder.com/i/algo/20220704113207.png) 至于出度和入度,那就是在有向图里的概念了,本题是无向图。 diff --git "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" old mode 100644 new mode 100755 index 33b48698b5..9048b0f6af --- "a/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" +++ "b/problems/1971.\345\257\273\346\211\276\345\233\276\344\270\255\346\230\257\345\220\246\345\255\230\345\234\250\350\267\257\345\276\204.md" @@ -12,7 +12,7 @@ 给你数组 edges 和整数 n、start 和 end,如果从 start 到 end 存在 有效路径 ,则返回 true,否则返回 false 。 -![](https://file.kamacoder.com/pics/20220705101442.png) +![](https://file1.kamacoder.com/i/algo/20220705101442.png) diff --git "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" index 830bba7e2a..d74f1a01aa 100644 --- "a/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" +++ "b/problems/O(n)\347\232\204\347\256\227\346\263\225\345\261\205\347\204\266\350\266\205\346\227\266\344\272\206\357\274\214\346\255\244\346\227\266\347\232\204n\347\251\266\347\253\237\346\230\257\345\244\232\345\244\247\357\274\237.md" @@ -13,7 +13,7 @@ ## 超时是怎么回事 -![程序超时](https://file.kamacoder.com/pics/20200729112716117.png) +![程序超时](https://file1.kamacoder.com/i/algo/20200729112716117.png) 大家在leetcode上练习算法的时候应该都遇到过一种错误是“超时”。 @@ -129,11 +129,11 @@ int main() { 来看一下运行的效果,如下图: -![程序超时2](https://file.kamacoder.com/pics/20200729200018460.png) +![程序超时2](https://file1.kamacoder.com/i/algo/20200729200018460.png) O(n)的算法,1s内大概计算机可以运行 5 * (10^8)次计算,可以推测一下O(n^2) 的算法应该1s可以处理的数量级的规模是 5 * (10^8)开根号,实验数据如下。 -![程序超时3](https://file.kamacoder.com/pics/2020072919590970.png) +![程序超时3](https://file1.kamacoder.com/i/algo/2020072919590970.png) O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚刚的推测。 @@ -141,7 +141,7 @@ O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚 理论上应该是比 O(n)少一个数量级,因为logn的复杂度 其实是很快,看一下实验数据。 -![程序超时4](https://file.kamacoder.com/pics/20200729195729407.png) +![程序超时4](https://file1.kamacoder.com/i/algo/20200729195729407.png) O(nlogn)的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符合预期。 @@ -149,7 +149,7 @@ O(nlogn)的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符 **整体测试数据整理如下:** -![程序超时1](https://file.kamacoder.com/pics/20201208231559175.png) +![程序超时1](https://file1.kamacoder.com/i/algo/20201208231559175.png) 至于O(log n)和O(n^3) 等等这些时间复杂度在1s内可以处理的多大的数据规模,大家可以自己写一写代码去测一下了。 diff --git "a/problems/kamacoder/0044.\345\274\200\345\217\221\345\225\206\350\264\255\344\271\260\345\234\237\345\234\260.md" "b/problems/kamacoder/0044.\345\274\200\345\217\221\345\225\206\350\264\255\344\271\260\345\234\237\345\234\260.md" index 64804842f2..cb5fbb7468 100644 --- "a/problems/kamacoder/0044.\345\274\200\345\217\221\345\225\206\350\264\255\344\271\260\345\234\237\345\234\260.md" +++ "b/problems/kamacoder/0044.\345\274\200\345\217\221\345\225\206\350\264\255\344\271\260\345\234\237\345\234\260.md" @@ -613,3 +613,4 @@ func main() { } ``` +
diff --git "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" index e361e8e0d9..80d7851eaf 100644 --- "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" +++ "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\345\240\206.md" @@ -46,13 +46,13 @@ 如下图所示,起始车站为 1 号车站,终点车站为 7 号车站,绿色路线为最短的路线,路线总长度为 12,则输出 12。 -![](https://file.kamacoder.com/pics/20240227101345.png) +![](https://file1.kamacoder.com/i/algo/20240227101345.png) 不能到达的情况: 如下图所示,当从起始车站不能到达终点车站时,则输出 -1。 -![](https://file.kamacoder.com/pics/20240227101401.png) +![](https://file1.kamacoder.com/i/algo/20240227101401.png) 数据范围: @@ -101,7 +101,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240222110025.png) +![](https://file1.kamacoder.com/i/algo/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间,有一条双向边,即:grid[2][5] = 6,grid[5][2] = 6 @@ -125,7 +125,7 @@ 邻接表的构造如图: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 这里表达的图是: @@ -210,7 +210,7 @@ vector> grid(n + 1); 不少录友,不知道 如何定义的数据结构,怎么表示邻接表的,我来给大家画一个图: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 图中邻接表表示: @@ -231,7 +231,7 @@ vector>> grid(n + 1); 举例来给大家展示 该代码表达的数据 如下: -![](https://file.kamacoder.com/pics/20240223103904.png) +![](https://file1.kamacoder.com/i/algo/20240223103904.png) * 节点1 指向 节点3 权值为 1 * 节点1 指向 节点5 权值为 2 @@ -354,7 +354,7 @@ for (int v = 1; v <= n; v++) { 再回顾一下邻接表的构造(数组 + 链表): -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 假如 加入的cur 是节点 2, 那么 grid[2] 表示的就是图中第二行链表。 (grid数组的构造我们在 上面 「图的存储」中讲过) @@ -927,3 +927,4 @@ func main() { ### C +
diff --git "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" index 1ff9f1a874..42099df92a 100644 --- "a/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" +++ "b/problems/kamacoder/0047.\345\217\202\344\274\232dijkstra\346\234\264\347\264\240.md" @@ -46,13 +46,13 @@ 如下图所示,起始车站为 1 号车站,终点车站为 7 号车站,绿色路线为最短的路线,路线总长度为 12,则输出 12。 -![](https://file.kamacoder.com/pics/20240227101345.png) +![](https://file1.kamacoder.com/i/algo/20240227101345.png) 不能到达的情况: 如下图所示,当从起始车站不能到达终点车站时,则输出 -1。 -![](https://file.kamacoder.com/pics/20240227101401.png) +![](https://file1.kamacoder.com/i/algo/20240227101401.png) 数据范围: @@ -76,7 +76,7 @@ dijkstra算法:在有权图(权值非负数)中求从起点到其他节点 如本题示例中的图: -![](https://file.kamacoder.com/pics/20240125162647.png) +![](https://file1.kamacoder.com/i/algo/20240125162647.png) 起点(节点1)到终点(节点7) 的最短路径是 图中 标记绿线的部分。 @@ -122,7 +122,7 @@ minDist数组数值初始化为int最大值。 这里在强点一下 **minDist数组的含义:记录所有节点到源点的最短路径**,那么初始化的时候就应该初始为最大值,这样才能在后续出现最短路径的时候及时更新。 -![](https://file.kamacoder.com/pics/20240130115306.png) +![](https://file1.kamacoder.com/i/algo/20240130115306.png) (图中,max 表示默认值,节点0 不做处理,统一从下标1 开始计算,这样下标和节点数值统一, 方便大家理解,避免搞混) @@ -144,7 +144,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130115421.png) +![](https://file1.kamacoder.com/i/algo/20240130115421.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -170,7 +170,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130121240.png) +![](https://file1.kamacoder.com/i/algo/20240130121240.png) 更新 minDist数组,即:源点(节点1) 到 节点6 、 节点3 和 节点4的距离。 @@ -204,7 +204,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240130120434.png) +![](https://file1.kamacoder.com/i/algo/20240130120434.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -224,7 +224,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201105335.png) +![](https://file1.kamacoder.com/i/algo/20240201105335.png) 由于节点4的加入,那么源点可以链接到节点5 所以更新minDist数组: @@ -244,7 +244,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110250.png) +![](https://file1.kamacoder.com/i/algo/20240201110250.png) 由于节点6的加入,那么源点可以链接到节点7 所以 更新minDist数组: @@ -264,7 +264,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110651.png) +![](https://file1.kamacoder.com/i/algo/20240201110651.png) 由于节点5的加入,那么源点有新的路径可以链接到节点7 所以 更新minDist数组: @@ -282,7 +282,7 @@ minDist数组数值初始化为int最大值。 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240201110920.png) +![](https://file1.kamacoder.com/i/algo/20240201110920.png) 节点7加入,但节点7到节点7的距离为0,所以 不用更新minDist数组 @@ -296,7 +296,7 @@ minDist数组数值初始化为int最大值。 路径如图: -![](https://file.kamacoder.com/pics/20240201111352.png) +![](https://file1.kamacoder.com/i/algo/20240201111352.png) 在上面的讲解中,每一步 我都是按照 dijkstra 三部曲来讲解的,理解了这三部曲,代码也就好懂的。 @@ -541,7 +541,7 @@ int main() { 对应如图: -![](https://file.kamacoder.com/pics/20240201111352.png) +![](https://file1.kamacoder.com/i/algo/20240201111352.png) ### 出现负数 @@ -549,7 +549,7 @@ int main() { 看一下这个图: (有负权值) -![](https://file.kamacoder.com/pics/20240227104334.png) +![](https://file1.kamacoder.com/i/algo/20240227104334.png) 节点1 到 节点5 的最短路径 应该是 节点1 -> 节点2 -> 节点3 -> 节点4 -> 节点5 @@ -559,7 +559,7 @@ int main() { 初始化: -![](https://file.kamacoder.com/pics/20240227104801.png) +![](https://file1.kamacoder.com/i/algo/20240227104801.png) --------------- @@ -573,7 +573,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110217.png) +![](https://file1.kamacoder.com/i/algo/20240227110217.png) 更新 minDist数组,即:源点(节点1) 到 节点2 和 节点3的距离。 @@ -592,7 +592,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110330.png) +![](https://file1.kamacoder.com/i/algo/20240227110330.png) 由于节点3的加入,那么源点可以有新的路径链接到节点4 所以更新minDist数组: @@ -610,7 +610,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110346.png) +![](https://file1.kamacoder.com/i/algo/20240227110346.png) 由于节点4的加入,那么源点可以有新的路径链接到节点5 所以更新minDist数组: @@ -628,7 +628,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110405.png) +![](https://file1.kamacoder.com/i/algo/20240227110405.png) 节点5的加入,而节点5 没有链接其他节点, 所以不用更新minDist数组,仅标记节点5被访问过了 @@ -644,7 +644,7 @@ int main() { 3、更新非访问节点到源点的距离(即更新minDist数组) ,如图: -![](https://file.kamacoder.com/pics/20240227110711.png) +![](https://file1.kamacoder.com/i/algo/20240227110711.png) -------------- @@ -942,3 +942,4 @@ main() ### C +
diff --git "a/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" "b/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" index 585fa4767e..53da7af9ee 100644 --- "a/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" +++ "b/problems/kamacoder/0053.\345\257\273\345\256\235-Kruskal.md" @@ -63,7 +63,7 @@ kruscal的思路: 依然以示例中,如下这个图来举例。 -![](https://file.kamacoder.com/pics/20240111113514.png) +![](https://file1.kamacoder.com/i/algo/20240111113514.png) 将图中的边按照权值有小到大排序,这样从贪心的角度来说,优先选 权值小的边加入到 最小生成树中。 @@ -77,13 +77,13 @@ kruscal的思路: 选边(1,2),节点1 和 节点2 不在同一个集合,所以生成树可以添加边(1,2),并将 节点1,节点2 放在同一个集合。 -![](https://file.kamacoder.com/pics/20240111114204.png) +![](https://file1.kamacoder.com/i/algo/20240111114204.png) -------- 选边(4,5),节点4 和 节点 5 不在同一个集合,生成树可以添加边(4,5) ,并将节点4,节点5 放到同一个集合。 -![](https://file.kamacoder.com/pics/20240111120458.png) +![](https://file1.kamacoder.com/i/algo/20240111120458.png) **大家判断两个节点是否在同一个集合,就看图中两个节点是否有绿色的粗线连着就行** @@ -93,25 +93,25 @@ kruscal的思路: 选边(1,3),节点1 和 节点3 不在同一个集合,生成树添加边(1,3),并将节点1,节点3 放到同一个集合。 -![](https://file.kamacoder.com/pics/20240112105834.png) +![](https://file1.kamacoder.com/i/algo/20240112105834.png) --------- 选边(2,6),节点2 和 节点6 不在同一个集合,生成树添加边(2,6),并将节点2,节点6 放到同一个集合。 -![](https://file.kamacoder.com/pics/20240112110214.png) +![](https://file1.kamacoder.com/i/algo/20240112110214.png) -------- 选边(3,4),节点3 和 节点4 不在同一个集合,生成树添加边(3,4),并将节点3,节点4 放到同一个集合。 -![](https://file.kamacoder.com/pics/20240112110450.png) +![](https://file1.kamacoder.com/i/algo/20240112110450.png) ---------- 选边(6,7),节点6 和 节点7 不在同一个集合,生成树添加边(6,7),并将 节点6,节点7 放到同一个集合。 -![](https://file.kamacoder.com/pics/20240112110637.png) +![](https://file1.kamacoder.com/i/algo/20240112110637.png) ----------- @@ -126,7 +126,7 @@ kruscal的思路: 此时 我们就已经生成了一个最小生成树,即: -![](https://file.kamacoder.com/pics/20240112110637.png) +![](https://file1.kamacoder.com/i/algo/20240112110637.png) 在上面的讲解中,看图的话 大家知道如何判断 两个节点 是否在同一个集合(是否有绿色的线连在一起),以及如何把两个节点加入集合(就在图中把两个节点连上) @@ -346,7 +346,7 @@ int main() { 大家可能发现 怎么和我们 模拟画的图不一样,差别在于 代码生成的最小生成树中 节点5 和 节点7相连的。 -![](https://file.kamacoder.com/pics/20240116163014.png) +![](https://file1.kamacoder.com/i/algo/20240116163014.png) 其实造成这个差别 是对边排序的时候 权值相同的边先后顺序的问题导致的,无论相同权值边的顺序是什么样的,最后都能得出最小生成树。 @@ -366,7 +366,7 @@ Kruskal 与 prim 的关键区别在于,prim维护的是节点的集合,而 K 节点未必一定要连着边那, 例如 这个图,大家能明显感受到边没有那么多对吧,但节点数量 和 上述我们讲的例子是一样的。 -![](https://file.kamacoder.com/pics/20240116152211.png) +![](https://file1.kamacoder.com/i/algo/20240116152211.png) 为什么边少的话,使用 Kruskal 更优呢? @@ -760,3 +760,4 @@ int main() } ``` +
diff --git "a/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" "b/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" index a7d3584178..df0129ee2a 100644 --- "a/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" +++ "b/problems/kamacoder/0053.\345\257\273\345\256\235-prim.md" @@ -61,7 +61,7 @@ 例如本题示例中的无向有权图为: -![](https://file.kamacoder.com/pics/20231206164306.png) +![](https://file1.kamacoder.com/i/algo/20231206164306.png) 那么在这个图中,如何选取n-1条边使得图中所有节点连接到一起,并且边的权值和最小呢? @@ -100,7 +100,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 如图: -![](https://file.kamacoder.com/pics/20231215105603.png) +![](https://file1.kamacoder.com/i/algo/20231215105603.png) 开始构造最小生成树 @@ -118,7 +118,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来,我们要更新所有节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102048.png) +![](https://file1.kamacoder.com/i/algo/20231222102048.png) 注意下标0,我们就不管它了,下标1与节点1对应,这样可以避免大家把节点搞混。 @@ -148,7 +148,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来,我们要更新节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102431.png) +![](https://file1.kamacoder.com/i/algo/20231222102431.png) 此时所有非生成树的节点距离最小生成树(节点1、节点2)的距离都已经跟新了。 @@ -172,7 +172,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来更新节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102457.png) +![](https://file1.kamacoder.com/i/algo/20231222102457.png) 所有非生成树的节点距离最小生成树(节点1、节点2、节点3)的距离都已经跟新了。 @@ -188,7 +188,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 继续选择一个距离最小生成树(节点1、节点2、节点3)最近的非生成树里的节点,为了巩固大家对minDist数组的理解,这里我再啰嗦一遍: -![](https://file.kamacoder.com/pics/20231217213516.png) +![](https://file1.kamacoder.com/i/algo/20231217213516.png) **minDist数组是记录了所有非生成树节点距离生成树的最小距离**,所以从数组里我们能看出来,非生成树节点4和节点6距离生成树最近。 @@ -209,7 +209,7 @@ minDist数组里的数值初始化为最大数,因为本题节点距离不会 接下来更新节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102618.png) +![](https://file1.kamacoder.com/i/algo/20231222102618.png) minDist数组已经更新了所有非生成树的节点距离最小生成树(节点1、节点2、节点3、节点4)的距离。 @@ -232,7 +232,7 @@ minDist数组已经更新了所有非生成树的节点距离最小生成树( 接下来更新节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102646.png) +![](https://file1.kamacoder.com/i/algo/20231222102646.png) minDist数组已经更新了所有非生成树的节点距离最小生成树(节点1、节点2、节点3、节点4、节点5)的距离。 @@ -253,11 +253,11 @@ minDist数组已经更新了所有非生成树的节点距离最小生成树( 节点1、节点2、节点3、节点4、节点5、节点6算是最小生成树的节点,接下来更新节点距离最小生成树的距离,如图: -![](https://file.kamacoder.com/pics/20231222102732.png) +![](https://file1.kamacoder.com/i/algo/20231222102732.png) 这里就不在重复描述了,大家类推,最后,节点7加入生成树,如图: -![](https://file.kamacoder.com/pics/20231222102820.png) +![](https://file1.kamacoder.com/i/algo/20231222102820.png) ### 最后 @@ -478,7 +478,7 @@ int main() { 大家可以和我们本题最后生成的最小生成树的图去对比一下边的链接情况: -![](https://file.kamacoder.com/pics/20231229115714.png) +![](https://file1.kamacoder.com/i/algo/20231229115714.png) 绿色的边是最小生成树,和我们的输出完全一致。 @@ -757,3 +757,4 @@ main() ### C +
diff --git "a/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" "b/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" index 665e8ecbae..67d31a5564 100644 --- "a/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" +++ "b/problems/kamacoder/0054.\346\233\277\346\215\242\346\225\260\345\255\227.md" @@ -29,11 +29,11 @@ 如图: -![](https://file.kamacoder.com/pics/20231030165201.png) +![](https://file1.kamacoder.com/i/algo/20231030165201.png) 然后从后向前替换数字字符,也就是双指针法,过程如下:i指向新长度的末尾,j指向旧长度的末尾。 -![](https://file.kamacoder.com/pics/20231030173058.png) +![](https://file1.kamacoder.com/i/algo/20231030173058.png) 有同学问了,为什么要从后向前填充,从前向后填充不行么? @@ -432,3 +432,4 @@ echo $s; ### Rust: +
diff --git "a/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" "b/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" index 48150222a7..be998390c5 100644 --- "a/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/kamacoder/0055.\345\217\263\346\227\213\345\255\227\347\254\246\344\270\262.md" @@ -40,16 +40,16 @@ fgabcde 本题中,我们需要将字符串右移n位,字符串相当于分成了两个部分,如果n为2,符串相当于分成了两个部分,如图: (length为字符串长度) -![](https://file.kamacoder.com/pics/20231106170143.png) +![](https://file1.kamacoder.com/i/algo/20231106170143.png) 右移n位, 就是将第二段放在前面,第一段放在后面,先不考虑里面字符的顺序,是不是整体倒叙不就行了。如图: -![](https://file.kamacoder.com/pics/20231106171557.png) +![](https://file1.kamacoder.com/i/algo/20231106171557.png) 此时第一段和第二段的顺序是我们想要的,但里面的字符位置被我们倒叙,那么此时我们在把 第一段和第二段里面的字符再倒叙一把,这样字符顺序不就正确了。 如果: -![](https://file.kamacoder.com/pics/20231106172058.png) +![](https://file1.kamacoder.com/i/algo/20231106172058.png) 其实,思路就是 通过 整体倒叙,把两段子串顺序颠倒,两个段子串里的的字符在倒叙一把,**负负得正**,这样就不影响子串里面字符的顺序了。 @@ -80,7 +80,7 @@ int main() { 可以的,不过,要记得 控制好 局部反转的长度,如果先局部反转,那么先反转的子串长度就是 len - n,如图: -![](https://file.kamacoder.com/pics/20231106172534.png) +![](https://file1.kamacoder.com/i/algo/20231106172534.png) 代码如下: @@ -409,3 +409,4 @@ echo $s; ### Rust: +
diff --git "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" index 8eaad9f0de..894e0383d5 100644 --- "a/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" +++ "b/problems/kamacoder/0058.\345\214\272\351\227\264\345\222\214.md" @@ -93,7 +93,7 @@ int main() { 如图: -![](https://file.kamacoder.com/pics/20240627110604.png) +![](https://file1.kamacoder.com/i/algo/20240627110604.png) 如果,我们想统计,在vec数组上 下标 2 到下标 5 之间的累加和,那是不是就用 p[5] - p[1] 就可以了。 @@ -109,7 +109,7 @@ int main() { 如图所示: -![](https://file.kamacoder.com/pics/20240627111319.png) +![](https://file1.kamacoder.com/i/algo/20240627111319.png) `p[5] - p[1]` 就是 红色部分的区间和。 @@ -408,3 +408,4 @@ func main() { } ``` +
diff --git "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" index b592029276..9d3fbe839e 100644 --- "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" +++ "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I-SPFA.md" @@ -62,7 +62,7 @@ 给大家举一个例子: -![](https://file.kamacoder.com/pics/20240328104119.png) +![](https://file1.kamacoder.com/i/algo/20240328104119.png) 本图中,对所有边进行松弛,真正有效的松弛,只有松弛 边(节点1->节点2) 和 边(节点1->节点3) 。 @@ -97,7 +97,7 @@ 初始化,起点为节点1, 起点到起点的最短距离为0,所以minDist[1] 为 0。 将节点1 加入队列 (下次松弛从节点1开始) -![](https://file.kamacoder.com/pics/20240411115555.png) +![](https://file1.kamacoder.com/i/algo/20240411115555.png) ------------ @@ -109,7 +109,7 @@ 将节点2、节点3 加入队列,如图: -![](https://file.kamacoder.com/pics/20240411115544.png) +![](https://file1.kamacoder.com/i/algo/20240411115544.png) ----------------- @@ -124,7 +124,7 @@ 将节点4,节点5 加入队列,如图: -![](https://file.kamacoder.com/pics/20240412110348.png) +![](https://file1.kamacoder.com/i/algo/20240412110348.png) -------------------- @@ -134,7 +134,7 @@ 因为没有从节点3作为出发点的边,所以这里就从队列里取出节点3就好,不用做其他操作,如图: -![](https://file.kamacoder.com/pics/20240412110420.png) +![](https://file1.kamacoder.com/i/algo/20240412110420.png) ------------ @@ -147,7 +147,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240412110445.png) +![](https://file1.kamacoder.com/i/algo/20240412110445.png) --------------- @@ -160,7 +160,7 @@ 如图,将节点3加入队列,因为节点6已经在队列里,所以不用重复添加 -![](https://file.kamacoder.com/pics/20240729161116.png) +![](https://file1.kamacoder.com/i/algo/20240729161116.png) 所以我们在加入队列的过程可以有一个优化,**用visited数组记录已经在队列里的元素,已经在队列的元素不用重复加入** @@ -174,7 +174,7 @@ 所以直接从队列中取出,如图: -![](https://file.kamacoder.com/pics/20240411115424.png) +![](https://file1.kamacoder.com/i/algo/20240411115424.png) ---------- @@ -264,7 +264,7 @@ int main() { 至于为什么 双向图且每一个节点和所有其他节点都相连的话,每个节点 都有 n-1 条指向该节点的边, 我再来举个例子,如图: -[](https://file.kamacoder.com/pics/20240416104138.png) +![](https://file1.kamacoder.com/i/algo/20240416104138.png) 图中 每个节点都与其他所有节点相连,节点数n 为 4,每个节点都有3条指向该节点的边,即入度为3。 @@ -329,7 +329,7 @@ SPFA(队列优化版Bellman_ford) 在理论上 时间复杂度更胜一筹 如图: -![](https://file.kamacoder.com/pics/20240412111849.png) +![](https://file1.kamacoder.com/i/algo/20240412111849.png) 正权回路 就是有环,但环的总权值为正数。 @@ -536,3 +536,4 @@ main() +
diff --git "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" index 9edde8ace3..63d1be2a30 100644 --- "a/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" +++ "b/problems/kamacoder/0094.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223I.md" @@ -46,7 +46,7 @@ 1 3 5 ``` -![](https://file.kamacoder.com/pics/20240509200224.png) +![](https://file1.kamacoder.com/i/algo/20240509200224.png) ## 思路 @@ -78,7 +78,7 @@ 这里我给大家举一个例子,每条边有起点、终点和边的权值。例如一条边,节点A 到 节点B 权值为value,如图: -![](https://file.kamacoder.com/pics/20240327102620.png) +![](https://file1.kamacoder.com/i/algo/20240327102620.png) minDist[B] 表示 到达B节点 最小权值,minDist[B] 有哪些状态可以推出来? @@ -127,7 +127,7 @@ if (minDist[B] > minDist[A] + value) minDist[B] = minDist[A] + value 如图: -![](https://file.kamacoder.com/pics/20240328104119.png) +![](https://file1.kamacoder.com/i/algo/20240328104119.png) 其他节点对应的minDist初始化为max,因为我们要求最小距离,那么还没有计算过的节点 默认是一个最大数,这样才能更新最小距离。 @@ -150,36 +150,36 @@ if (minDist[B] > minDist[A] + value) minDist[B] = minDist[A] + value 边:节点5 -> 节点6,权值为-2 ,minDist[5] 还是默认数值max,所以不能基于 节点5 去更新节点6,如图: -![](https://file.kamacoder.com/pics/20240329113537.png) +![](https://file1.kamacoder.com/i/algo/20240329113537.png) (在复习一下,minDist[5] 表示起点到节点5的最短距离) 边:节点1 -> 节点2,权值为1 ,minDist[2] > minDist[1] + 1 ,更新 minDist[2] = minDist[1] + 1 = 0 + 1 = 1 ,如图: -![](https://file.kamacoder.com/pics/20240329113703.png) +![](https://file1.kamacoder.com/i/algo/20240329113703.png) 边:节点5 -> 节点3,权值为1 ,minDist[5] 还是默认数值max,所以不能基于节点5去更新节点3 如图: -![](https://file.kamacoder.com/pics/20240329113827.png) +![](https://file1.kamacoder.com/i/algo/20240329113827.png) 边:节点2 -> 节点5,权值为2 ,minDist[5] > minDist[2] + 2 (经过上面的计算minDist[2]已经不是默认值,而是 1),更新 minDist[5] = minDist[2] + 2 = 1 + 2 = 3 ,如图: -![](https://file.kamacoder.com/pics/20240329113927.png) +![](https://file1.kamacoder.com/i/algo/20240329113927.png) 边:节点2 -> 节点4,权值为-3 ,minDist[4] > minDist[2] + (-3),更新 minDist[4] = minDist[2] + (-3) = 1 + (-3) = -2 ,如图: -![](https://file.kamacoder.com/pics/20240329114036.png) +![](https://file1.kamacoder.com/i/algo/20240329114036.png) 边:节点4 -> 节点6,权值为4 ,minDist[6] > minDist[4] + 4,更新 minDist[6] = minDist[4] + 4 = -2 + 4 = 2 -![](https://file.kamacoder.com/pics/20240329114120.png) +![](https://file1.kamacoder.com/i/algo/20240329114120.png) 边:节点1 -> 节点3,权值为5 ,minDist[3] > minDist[1] + 5,更新 minDist[3] = minDist[1] + 5 = 0 + 5 = 5 ,如图: -![](https://file.kamacoder.com/pics/20240329114324.png) +![](https://file1.kamacoder.com/i/algo/20240329114324.png) -------- @@ -538,3 +538,4 @@ main() ### C +
diff --git "a/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" "b/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" index 5dddf45013..957b8a80bc 100644 --- "a/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" +++ "b/problems/kamacoder/0095.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223II.md" @@ -78,7 +78,7 @@ circle 我们拿题目中示例来画一个图: -![](https://file.kamacoder.com/pics/20240705161426.png) +![](https://file1.kamacoder.com/i/algo/20240705161426.png) 图中 节点1 到 节点4 的最短路径是多少(题目中的最低运输成本) (注意边可以为负数的) @@ -86,7 +86,7 @@ circle 而图中有负权回路: -![](https://file.kamacoder.com/pics/20240402103712.png) +![](https://file1.kamacoder.com/i/algo/20240402103712.png) 那么我们在负权回路中多绕一圈,我们的最短路径 是不是就更小了 (也就是更低的运输成本) @@ -456,3 +456,4 @@ if __name__ == "__main__": ### C +
diff --git "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" index 37cfaee0e3..0c00ccb668 100644 --- "a/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" +++ "b/problems/kamacoder/0096.\345\237\216\345\270\202\351\227\264\350\264\247\347\211\251\350\277\220\350\276\223III.md" @@ -63,7 +63,7 @@ 本题是最多经过 k 个城市, 那么是 k + 1条边相连的节点。 这里可能有录友想不懂为什么是k + 1,来看这个图: -![](https://file.kamacoder.com/pics/20240402115614.png) +![](https://file1.kamacoder.com/i/algo/20240402115614.png) 图中,节点1 最多已经经过2个节点 到达节点4,那么中间是有多少条边呢,是 3 条边对吧。 @@ -195,7 +195,7 @@ int main() { 起点为节点1, 起点到起点的距离为0,所以 minDist[1] 初始化为0 ,如图: -![](https://file.kamacoder.com/pics/20240409111940.png) +![](https://file1.kamacoder.com/i/algo/20240409111940.png) 其他节点对应的minDist初始化为max,因为我们要求最小距离,那么还没有计算过的节点 默认是一个最大数,这样才能更新最小距离。 @@ -203,21 +203,21 @@ int main() { 边:节点1 -> 节点2,权值为-1 ,minDist[2] > minDist[1] + (-1),更新 minDist[2] = minDist[1] + (-1) = 0 - 1 = -1 ,如图: -![](https://file.kamacoder.com/pics/20240409111914.png) +![](https://file1.kamacoder.com/i/algo/20240409111914.png) 边:节点2 -> 节点3,权值为1 ,minDist[3] > minDist[2] + 1 ,更新 minDist[3] = minDist[2] + 1 = -1 + 1 = 0 ,如图: -![](https://file.kamacoder.com/pics/20240409111903.png) +![](https://file1.kamacoder.com/i/algo/20240409111903.png) 边:节点3 -> 节点1,权值为-1 ,minDist[1] > minDist[3] + (-1),更新 minDist[1] = 0 + (-1) = -1 ,如图: -![](https://file.kamacoder.com/pics/20240409111849.png) +![](https://file1.kamacoder.com/i/algo/20240409111849.png) 边:节点3 -> 节点4,权值为1 ,minDist[4] > minDist[3] + 1,更新 minDist[4] = 0 + 1 = 1 ,如图: -![](https://file.kamacoder.com/pics/20241018192042.png) +![](https://file1.kamacoder.com/i/algo/20241018192042.png) 以上是对所有边进行的第一次松弛,最后 minDist数组为 :-1 -1 0 1 ,(从下标1算起) @@ -244,7 +244,7 @@ int main() { 在上面画图距离中,对所有边进行第一次松弛,在计算 边(节点2 -> 节点3) 的时候,更新了 节点3。 -![](https://file.kamacoder.com/pics/20240409111903.png) +![](https://file1.kamacoder.com/i/algo/20240409111903.png) 理论上来说节点3 应该在对所有边第二次松弛的时候才更新。 这因为当时是基于已经计算好的 节点2(minDist[2])来做计算了。 @@ -331,11 +331,11 @@ int main() { 所构成是图是一样的,都是如下的这个图,但给出的边的顺序是不一样的。 -![](https://file.kamacoder.com/pics/20240410154340.png) +![](https://file1.kamacoder.com/i/algo/20240410154340.png) 再用版本一的代码是运行一下,发现结果输出是 1, 是对的。 -![](https://file.kamacoder.com/pics/20240410154940.png) +![](https://file1.kamacoder.com/i/algo/20240410154940.png) 分明刚刚输出的结果是 -2,是错误的,怎么 一样的图,这次输出的结果就对了呢? @@ -345,7 +345,7 @@ int main() { 初始化: -![](https://file.kamacoder.com/pics/20240410155545.png) +![](https://file1.kamacoder.com/i/algo/20240410155545.png) 边:节点3 -> 节点1,权值为-1 ,节点3还没有被计算过,节点1 不更新。 @@ -355,7 +355,7 @@ int main() { 边:节点1 -> 节点2,权值为 -1 ,minDist[2] > minDist[1] + (-1),更新 minDist[2] = 0 + (-1) = -1 ,如图: -![](https://file.kamacoder.com/pics/20240410160046.png) +![](https://file1.kamacoder.com/i/algo/20240410160046.png) 以上是对所有边 松弛一次的状态。 @@ -472,7 +472,7 @@ int main() { 但大家会发现,以上代码大家提交后,怎么耗时这么多? -![](https://file.kamacoder.com/pics/20240418113308.png) +![](https://file1.kamacoder.com/i/algo/20240418113308.png) 理论上,SPFA的时间复杂度不是要比 bellman_ford 更优吗? @@ -554,7 +554,7 @@ int main() { 以上代码提交后,耗时情况: -![](https://file.kamacoder.com/pics/20240418113952.png) +![](https://file1.kamacoder.com/i/algo/20240418113952.png) 大家发现 依然远比 bellman_ford 的代码版本 耗时高。 @@ -579,11 +579,11 @@ dijkstra 是贪心的思路 每一次搜索都只会找距离源点最近的非 在以下这个图中,求节点1 到 节点7 最多经过2个节点 的最短路是多少呢? -![](https://file.kamacoder.com/pics/20240508112249.png) +![](https://file1.kamacoder.com/i/algo/20240508112249.png) 最短路显然是: -![](https://file.kamacoder.com/pics/20240508112416.png) +![](https://file1.kamacoder.com/i/algo/20240508112416.png) 最多经过2个节点,也就是3条边相连的路线:节点1 -> 节点2 -> 节点6-> 节点7 @@ -591,24 +591,24 @@ dijkstra 是贪心的思路 每一次搜索都只会找距离源点最近的非 初始化如图所示: -![](https://file.kamacoder.com/pics/20240130115306.png) +![](https://file1.kamacoder.com/i/algo/20240130115306.png) 找距离源点最近且没有被访问过的节点,先找节点1 -![](https://file.kamacoder.com/pics/20240130115421.png) +![](https://file1.kamacoder.com/i/algo/20240130115421.png) 距离源点最近且没有被访问过的节点,找节点2: -![](https://file.kamacoder.com/pics/20240130121240.png) +![](https://file1.kamacoder.com/i/algo/20240130121240.png) 距离源点最近且没有被访问过的节点,找到节点3: -![](https://file.kamacoder.com/pics/20240130120434.png) +![](https://file1.kamacoder.com/i/algo/20240130120434.png) 距离源点最近且没有被访问过的节点,找到节点4: -![](https://file.kamacoder.com/pics/20240201105335.png) +![](https://file1.kamacoder.com/i/algo/20240201105335.png) 此时最多经过2个节点的搜索就完毕了,但结果中minDist[7] (即节点7的结果)并没有被更。 @@ -922,3 +922,4 @@ if __name__ == "__main__": ### C +
diff --git "a/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" "b/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" index 97765ebc7b..53e66ee46f 100644 --- "a/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" +++ "b/problems/kamacoder/0097.\345\260\217\346\230\216\351\200\233\345\205\254\345\233\255.md" @@ -155,7 +155,7 @@ grid[i][j][k] = m,表示 节点i 到 节点j 以[1...k] 集合为中间节点 grid数组是一个三维数组,那么我们初始化的数据在 i 与 j 构成的平层,如图: -![](https://file.kamacoder.com/pics/20240425104247.png) +![](https://file1.kamacoder.com/i/algo/20240425104247.png) 红色的 底部一层是我们初始化好的数据,注意:从三维角度去看初始化的数据很重要,下面我们在聊遍历顺序的时候还会再讲。 @@ -202,7 +202,7 @@ vector>> grid(n + 1, vector>(n + 1, vector(n 所以遍历k 的for循环一定是在最外面,这样才能一层一层去遍历。如图: -![](https://file.kamacoder.com/pics/20240424120109.png) +![](https://file1.kamacoder.com/i/algo/20240424120109.png) 至于遍历 i 和 j 的话,for 循环的先后顺序无所谓。 @@ -234,7 +234,7 @@ for (int i = 1; i <= n; i++) { 此时就遍历了 j 与 k 形成一个平面,i 则是纵面,那遍历 就是这样的: -![](https://file.kamacoder.com/pics/20240424115827.png) +![](https://file1.kamacoder.com/i/algo/20240424115827.png) 而我们初始化的数据 是 k 为0, i 和 j 形成的平面做初始化,如果以 k 和 j 形成的平面去一层一层遍历,就造成了 递推公式 用不上上一轮计算的结果,从而导致结果不对(初始化的部分是 i 与j 形成的平面,在初始部分有讲过)。 @@ -253,7 +253,7 @@ for (int i = 1; i <= n; i++) { 就是图: -![](https://file.kamacoder.com/pics/20240424120942.png) +![](https://file1.kamacoder.com/i/algo/20240424120942.png) 求节点1 到 节点 2 的最短距离,运行结果是 10 ,但正确的结果很明显是3。 @@ -267,7 +267,7 @@ for (int i = 1; i <= n; i++) { 而遍历k 的for循环如果放在中间呢,同样是 j 与k 行程一个平面,i 是纵面,遍历的也是这样: -![](https://file.kamacoder.com/pics/20240424115827.png) +![](https://file1.kamacoder.com/i/algo/20240424115827.png) 同样不能完全用上初始化 和 上一层计算的结果。 @@ -283,7 +283,7 @@ for (int i = 1; i <= n; i++) { 图: -![](https://file.kamacoder.com/pics/20240425112636.png) +![](https://file1.kamacoder.com/i/algo/20240425112636.png) 求 节点1 到节点3 的最短距离,如果k循环放中间,程序的运行结果是 -1,也就是不能到达节点3。 @@ -574,3 +574,4 @@ if __name__ == '__main__': ### C +
diff --git "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" index 2f0dcdcc87..c71981996b 100644 --- "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" @@ -43,7 +43,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240514103953.png) +![](https://file1.kamacoder.com/i/algo/20240514103953.png) 用例解释: @@ -141,7 +141,7 @@ while (m--) { 我在 [图论理论基础篇](./图论理论基础.md) 举了一个例子: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 这里表达的图是: @@ -887,3 +887,4 @@ async function dfs(graph, x, n) { +
diff --git "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" index 0da2f315a1..93c1fe41fa 100644 --- "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" +++ "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\345\271\277\346\220\234.md" @@ -35,7 +35,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240516111613.png) +![](https://file1.kamacoder.com/i/algo/20240516111613.png) 根据测试案例中所展示,岛屿数量共有 3 个,所以输出 3。 @@ -50,7 +50,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 @@ -72,7 +72,7 @@ 如果从队列拿出节点,再去标记这个节点走过,就会发生下图所示的结果,会导致很多节点重复加入队列。 -![](https://file.kamacoder.com/pics/20250124094043.png) +![](https://file1.kamacoder.com/i/algo/20250124094043.png) 超时写法 (从队列中取出节点再标记,注意代码注释的地方) @@ -557,3 +557,4 @@ object Solution { ### C +
diff --git "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" index 06be926874..3c54278af0 100644 --- "a/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" +++ "b/problems/kamacoder/0099.\345\262\233\345\261\277\347\232\204\346\225\260\351\207\217\346\267\261\346\220\234.md" @@ -36,7 +36,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240516111613.png) +![](https://file1.kamacoder.com/i/algo/20240516111613.png) 根据测试案例中所展示,岛屿数量共有 3 个,所以输出 3。 @@ -50,7 +50,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题题目是 DFS,BFS,并查集,基础题目。 @@ -459,3 +459,4 @@ object Solution { ### C +
diff --git "a/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" "b/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" index f2b9b901d1..2ae1f452e0 100644 --- "a/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" +++ "b/problems/kamacoder/0100.\345\262\233\345\261\277\347\232\204\346\234\200\345\244\247\351\235\242\347\247\257.md" @@ -33,7 +33,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240517103410.png) +![](https://file1.kamacoder.com/i/algo/20240517103410.png) 样例输入中,岛屿的最大面积为 4。 @@ -48,7 +48,7 @@ 也就是说斜角度链接是不算了, 例如示例二,是三个岛屿,如图: -![图一](https://file.kamacoder.com/pics/20220726094200.png) +![图一](https://file1.kamacoder.com/i/algo/20220726094200.png) 这道题目也是 dfs bfs基础类题目,就是搜索每个岛屿上“1”的数量,然后取一个最大的。 @@ -890,3 +890,4 @@ main(); ### C +
diff --git "a/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" "b/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" index c8fe372cd9..c883100724 100644 --- "a/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" +++ "b/problems/kamacoder/0101.\345\255\244\345\262\233\347\232\204\346\200\273\351\235\242\347\247\257.md" @@ -37,7 +37,7 @@ 提示信息: -![](https://file.kamacoder.com/pics/20240517105557.png) +![](https://file1.kamacoder.com/i/algo/20240517105557.png) 在矩阵中心部分的岛屿,因为没有任何一个单元格接触到矩阵边缘,所以该岛屿属于孤岛,总面积为 1。 @@ -54,11 +54,11 @@ 如图,在遍历地图周围四个边,靠地图四边的陆地,都为绿色, -![](https://file.kamacoder.com/pics/20220830104632.png) +![](https://file1.kamacoder.com/i/algo/20220830104632.png) 在遇到地图周边陆地的时候,将1都变为0,此时地图为这样: -![](https://file.kamacoder.com/pics/20220830104651.png) +![](https://file1.kamacoder.com/i/algo/20220830104651.png) 然后我们再去遍历这个地图,遇到有陆地的地方,去采用深搜或者广搜,边统计所有陆地。 @@ -700,3 +700,4 @@ const bfs = (graph, x, y) => { ### C +
diff --git "a/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" "b/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" index 265ec31f73..1b31676277 100644 --- "a/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" +++ "b/problems/kamacoder/0102.\346\262\211\346\262\241\345\255\244\345\262\233.md" @@ -43,11 +43,11 @@ 提示信息: -![](https://file.kamacoder.com/pics/20240517110932.png) +![](https://file1.kamacoder.com/i/algo/20240517110932.png) 将孤岛沉没: -![](https://file.kamacoder.com/pics/20240517110953.png) +![](https://file1.kamacoder.com/i/algo/20240517110953.png) 数据范围: @@ -73,7 +73,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240517113813.png) +![](https://file1.kamacoder.com/i/algo/20240517113813.png) 整体C++代码如下,以下使用dfs实现,其实遍历方式dfs,bfs都是可以的。 @@ -503,3 +503,4 @@ const bfs = (graph, x, y) => { ### C +
diff --git "a/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" "b/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" index 5924cb18a9..bf6cd40f43 100644 --- "a/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" +++ "b/problems/kamacoder/0103.\346\260\264\346\265\201\351\227\256\351\242\230.md" @@ -48,7 +48,7 @@ 提示信息: -![](https://file.kamacoder.com/pics/20240517115816.png) +![](https://file1.kamacoder.com/i/algo/20240517115816.png) 图中的蓝色方块上的雨水既能流向第一组边界,也能流向第二组边界。所以最终答案为所有蓝色方块的坐标。 @@ -166,11 +166,11 @@ int main() { 从第一组边界边上节点出发,如图: (图中并没有把所有遍历的方向都画出来,只画关键部分) -![](https://file.kamacoder.com/pics/20250304174747.png) +![](https://file1.kamacoder.com/i/algo/20250304174747.png) 从第二组边界上节点出发,如图: (图中并没有把所有遍历的方向都画出来,只画关键部分) -![](https://file.kamacoder.com/pics/20250304174801.png) +![](https://file1.kamacoder.com/i/algo/20250304174801.png) 最后,我们得到两个方向交界的这些节点,就是我们最后要求的节点。 @@ -854,3 +854,4 @@ const isResult = (x, y) => { +
diff --git "a/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" "b/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" index 483d777275..8c4964a9e4 100644 --- "a/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" +++ "b/problems/kamacoder/0104.\345\273\272\351\200\240\346\234\200\345\244\247\345\262\233\345\261\277.md" @@ -35,12 +35,12 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240522154055.png) +![](https://file1.kamacoder.com/i/algo/20240522154055.png) 对于上面的案例,有两个位置可将 0 变成 1,使得岛屿的面积最大,即 6。 -![](https://file.kamacoder.com/pics/20240522154110.png) +![](https://file1.kamacoder.com/i/algo/20240522154110.png) 数据范围: @@ -70,11 +70,11 @@ 拿如下地图的岛屿情况来举例: (1为陆地) -![](https://file.kamacoder.com/pics/20220829104834.png) +![](https://file1.kamacoder.com/i/algo/20220829104834.png) 第一步,则遍历地图,并将岛屿的编号和面积都统计好,过程如图所示: -![](https://file.kamacoder.com/pics/20220829105644.png) +![](https://file1.kamacoder.com/i/algo/20220829105644.png) 本过程代码如下: @@ -121,7 +121,7 @@ int largestIsland(vector>& grid) { 第二步过程如图所示: -![](https://file.kamacoder.com/pics/20220829105249.png) +![](https://file1.kamacoder.com/i/algo/20220829105249.png) 也就是遍历每一个0的方格,并统计其相邻岛屿面积,最后取一个最大值。 @@ -663,3 +663,4 @@ const dfs = (graph, visited, x, y, mark) => { ### C +
diff --git "a/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" "b/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" index cfe77c0d38..1358f673d5 100644 --- "a/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" +++ "b/problems/kamacoder/0105.\346\234\211\345\220\221\345\233\276\347\232\204\345\256\214\345\205\250\345\217\257\350\276\276\346\200\247.md" @@ -33,7 +33,7 @@ 【提示信息】 -![](https://file.kamacoder.com/pics/20240522174707.png) +![](https://file1.kamacoder.com/i/algo/20240522174707.png) 从 1 号节点可以到达任意节点,输出 1。 @@ -48,7 +48,7 @@ 接下来我们再画一个图,从图里可以直观看出来,节点6 是 不能到达节点1 的 -![](https://file.kamacoder.com/pics/20240522175451.png) +![](https://file1.kamacoder.com/i/algo/20240522175451.png) 这就很容易让我们想起岛屿问题,只要发现独立的岛,就是不可到达的。 @@ -553,3 +553,4 @@ rl.on('close',()=>{ ### C +
diff --git "a/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" "b/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" index a1ef2a76eb..4492d5cd6d 100644 --- "a/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" +++ "b/problems/kamacoder/0106.\345\262\233\345\261\277\347\232\204\345\221\250\351\225\277.md" @@ -37,7 +37,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240524115244.png) +![](https://file1.kamacoder.com/i/algo/20240524115244.png) 岛屿的周长为 14。 @@ -57,14 +57,14 @@ 如果该陆地上下左右的空格是有水域,则说明是一条边,如图: -![](https://file.kamacoder.com/pics/20240524115933.png) +![](https://file1.kamacoder.com/i/algo/20240524115933.png) 陆地的右边空格是水域,则说明找到一条边。 如果该陆地上下左右的空格出界了,则说明是一条边,如图: -![](https://file.kamacoder.com/pics/20240524120105.png) +![](https://file1.kamacoder.com/i/algo/20240524120105.png) 该陆地的下边空格出界了,则说明找到一条边。 @@ -114,7 +114,7 @@ int main() { 因为有一对相邻两个陆地,边的总数就要减2,如图红线部分,有两个陆地相邻,总边数就要减2 -![](https://file.kamacoder.com/pics/20240524120855.png) +![](https://file1.kamacoder.com/i/algo/20240524120855.png) 那么只需要在计算出相邻岛屿的数量就可以了,相邻岛屿数量为cover。 @@ -359,3 +359,4 @@ func parseLine(line string, count int) []int { ### C +
diff --git "a/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" "b/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" index 363a188465..9ab3388f17 100644 --- "a/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0107.\345\257\273\346\211\276\345\255\230\345\234\250\347\232\204\350\267\257\345\276\204.md" @@ -40,7 +40,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240527104432.png) +![](https://file1.kamacoder.com/i/algo/20240527104432.png) 数据范围: @@ -422,3 +422,4 @@ const isSame = (u, v) => { ### C +
diff --git "a/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" "b/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" index fe641f53c9..de2435073c 100644 --- "a/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" +++ "b/problems/kamacoder/0108.\345\206\227\344\275\231\350\277\236\346\216\245.md" @@ -9,11 +9,11 @@ 有一个图,它是一棵树,他是拥有 n 个节点(节点编号1到n)和 n - 1 条边的连通无环无向图(其实就是一个线形图),如图: -![](https://file.kamacoder.com/pics/20240905163122.png) +![](https://file1.kamacoder.com/i/algo/20240905163122.png) 现在在这棵树上的基础上,添加一条边(依然是n个节点,但有n条边),使这个图变成了有环图,如图 -![](https://file.kamacoder.com/pics/20240905164721.png) +![](https://file1.kamacoder.com/i/algo/20240905164721.png) 先请你找出冗余边,删除后,使该图可以重新变成一棵树。 @@ -42,7 +42,7 @@ 提示信息 -![](https://file.kamacoder.com/pics/20240527110320.png) +![](https://file1.kamacoder.com/i/algo/20240527110320.png) 图中的 1 2,2 3,1 3 等三条边在删除后都能使原图变为一棵合法的树。但是 1 3 由于是标准输入里最后出现的那条边,所以输出结果为 1 3 @@ -69,13 +69,13 @@ 如图所示,节点A 和节点 B 不在同一个集合,那么就可以将两个 节点连在一起。 -![](https://file.kamacoder.com/pics/20230604104720.png) +![](https://file1.kamacoder.com/i/algo/20230604104720.png) 如果边的两个节点已经出现在同一个集合里,说明着边的两个节点已经连在一起了,再加入这条边一定就出现环了。 如图所示: -![](https://file.kamacoder.com/pics/20230604104330.png) +![](https://file1.kamacoder.com/i/algo/20230604104330.png) 已经判断 节点A 和 节点B 在在同一个集合(同一个根),如果将 节点A 和 节点B 连在一起就一定会出现环。 @@ -157,7 +157,7 @@ int main() { 图: -![](https://file.kamacoder.com/pics/20240527110320.png) +![](https://file1.kamacoder.com/i/algo/20240527110320.png) 输出示例 @@ -376,3 +376,4 @@ const isSame = (u, v) => { ### C +
diff --git "a/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" "b/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" index 78132a3256..6ad59c4188 100644 --- "a/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" +++ "b/problems/kamacoder/0109.\345\206\227\344\275\231\350\277\236\346\216\245II.md" @@ -9,11 +9,11 @@ 有一种有向树,该树只有一个根节点,所有其他节点都是该根节点的后继。该树除了根节点之外的每一个节点都有且只有一个父节点,而根节点没有父节点。有向树拥有 n 个节点和 n - 1 条边。如图:  - + 现在有一个有向图,有向图是在有向树中的两个没有直接链接的节点中间添加一条有向边。如图: - + 输入一个有向图,该图由一个有着 n 个节点(节点编号 从 1 到 n),n 条边,请返回一条可以删除的边,使得删除该条边之后该有向图可以被当作一颗有向树。 @@ -42,7 +42,7 @@ 提示信息 - + 在删除 2 3 后有向图可以变为一棵合法的有向树,所以输出 2 3 @@ -64,13 +64,13 @@ 如图: -![](https://file.kamacoder.com/pics/20240527115807.png) +![](https://file1.kamacoder.com/i/algo/20240527115807.png) 找到了节点3 的入度为2,删 1 -> 3 或者 2 -> 3 。选择删顺序靠后便可。 但 入度为2 还有一种情况,情况二,只能删特定的一条边,如图: -![](https://file.kamacoder.com/pics/20240527151456.png) +![](https://file1.kamacoder.com/i/algo/20240527151456.png) 节点3 的入度为 2,但在删除边的时候,只能删 这条边(节点1 -> 节点3),如果删这条边(节点4 -> 节点3),那么删后本图也不是有向树了(因为找不到根节点)。 @@ -81,7 +81,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240527120531.png) +![](https://file1.kamacoder.com/i/algo/20240527120531.png) 对于情况三,删掉构成环的边就可以了。 @@ -596,3 +596,4 @@ const getRemoveEdge = (edges) => { ### C +
diff --git "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" index af3436901c..6cb5886d20 100644 --- "a/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" +++ "b/problems/kamacoder/0110.\345\255\227\347\254\246\344\270\262\346\216\245\351\276\231.md" @@ -57,7 +57,7 @@ yhn 2 <= N <= 500

- +

@@ -65,7 +65,7 @@ yhn 以示例1为例,从这个图中可以看出 abc 到 def的路线 不止一条,但最短的一条路径上是4个节点。 -![](https://file.kamacoder.com/pics/20250317105155.png) +![](https://file1.kamacoder.com/i/algo/20250317105155.png) 本题只需要求出最短路径的长度就可以了,不用找出具体路径。 @@ -360,3 +360,4 @@ const init = async () => { ### C +
diff --git "a/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" "b/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" index 18802765a9..c5650d9708 100644 --- "a/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" +++ "b/problems/kamacoder/0117.\350\275\257\344\273\266\346\236\204\345\273\272.md" @@ -39,7 +39,7 @@ 文件依赖关系如下: -![](https://file.kamacoder.com/pics/20240510192157.png) +![](https://file1.kamacoder.com/i/algo/20240510192157.png) 所以,文件处理的顺序除了示例中的顺序,还存在 @@ -104,7 +104,7 @@ 以题目中示例为例如图: -![](https://file.kamacoder.com/pics/20240510110836.png) +![](https://file1.kamacoder.com/i/algo/20240510110836.png) 做拓扑排序的话,如果肉眼去找开头的节点,一定能找到 节点0 吧,都知道要从节点0 开始。 @@ -135,17 +135,17 @@ 1、找到入度为0 的节点,加入结果集 -![](https://file.kamacoder.com/pics/20240510113110.png) +![](https://file1.kamacoder.com/i/algo/20240510113110.png) 2、将该节点从图中移除 -![](https://file.kamacoder.com/pics/20240510113142.png) +![](https://file1.kamacoder.com/i/algo/20240510113142.png) ---------------- 1、找到入度为0 的节点,加入结果集 -![](https://file.kamacoder.com/pics/20240510113345.png) +![](https://file1.kamacoder.com/i/algo/20240510113345.png) 这里大家会发现,节点1 和 节点2 入度都为0, 选哪个呢? @@ -153,19 +153,19 @@ 2、将该节点从图中移除 -![](https://file.kamacoder.com/pics/20240510113640.png) +![](https://file1.kamacoder.com/i/algo/20240510113640.png) --------------- 1、找到入度为0 的节点,加入结果集 -![](https://file.kamacoder.com/pics/20240510113853.png) +![](https://file1.kamacoder.com/i/algo/20240510113853.png) 节点2 和 节点3 入度都为0,选哪个都行,这里选节点2 2、将该节点从图中移除 -![](https://file.kamacoder.com/pics/20240510114004.png) +![](https://file1.kamacoder.com/i/algo/20240510114004.png) -------------- @@ -177,7 +177,7 @@ 如果有 有向环怎么办呢?例如这个图: -![](https://file.kamacoder.com/pics/20240510115115.png) +![](https://file1.kamacoder.com/i/algo/20240510115115.png) 这个图,我们只能将入度为0 的节点0 接入结果集。 @@ -252,13 +252,13 @@ while (que.size()) { 如果这里不理解,看上面的模拟过程第一步: -![](https://file.kamacoder.com/pics/20240510113110.png) +![](https://file1.kamacoder.com/i/algo/20240510113110.png) 这事节点1 和 节点2 的入度为 1。 将节点0删除后,图为这样: -![](https://file.kamacoder.com/pics/20240510113142.png) +![](https://file1.kamacoder.com/i/algo/20240510113142.png) 那么 节点0 作为出发点 所连接的节点的入度 就都做了 减一 的操作。 @@ -539,3 +539,4 @@ const init = async () => { ### C +
diff --git "a/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" "b/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" index 7d0096d52d..6669ce7ba1 100644 --- "a/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" +++ "b/problems/kamacoder/0126.\351\252\221\345\243\253\347\232\204\346\224\273\345\207\273astar.md" @@ -9,7 +9,7 @@ 骑士移动规则如图,红色是起始位置,黄色是骑士可以走的地方。 -![](https://file.kamacoder.com/pics/20240626104833.png) +![](https://file1.kamacoder.com/i/algo/20240626104833.png) 棋盘大小 1000 x 1000(棋盘的 x 和 y 坐标均在 [1, 1000] 区间内,包含边界) @@ -108,7 +108,7 @@ int main() 我们来看一下广搜的搜索过程,如图,红色是起点,绿色是终点,黄色是要遍历的点,最后从 起点 找到 达到终点的最短路径是棕色。 -![](https://file.kamacoder.com/pics/20240611143712.png) +![](https://file1.kamacoder.com/i/algo/20240611143712.png) 可以看出 广搜中,做了很多无用的遍历, 黄色的格子是广搜遍历到的点。 @@ -131,11 +131,11 @@ Astar 是一种 广搜的改良版。 有的是 Astar是 dijkstra 的改良版 在BFS中,我们想搜索,从起点到终点的最短路径,要一层一层去遍历。 -![](https://file.kamacoder.com/pics/20240611143712.png) +![](https://file1.kamacoder.com/i/algo/20240611143712.png) 如果 使用A * 的话,其搜索过程是这样的,如图,图中着色的都是我们要遍历的点。 -![](https://file.kamacoder.com/pics/20240611195223.png) +![](https://file1.kamacoder.com/i/algo/20240611195223.png) (上面两图中 最短路长度都是8,只是走的方式不同而已) @@ -684,3 +684,4 @@ int main() { +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\344\270\272\344\273\200\344\271\210\347\224\250ACM\346\250\241\345\274\217.md" "b/problems/kamacoder/\345\233\276\350\256\272\344\270\272\344\273\200\344\271\210\347\224\250ACM\346\250\241\345\274\217.md" index 362ea9714a..c5122b1760 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\344\270\272\344\273\200\344\271\210\347\224\250ACM\346\250\241\345\274\217.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\344\270\272\344\273\200\344\271\210\347\224\250ACM\346\250\241\345\274\217.md" @@ -91,3 +91,4 @@ cout << result[result.size() - 1]; 等大家将图论刷完,就会感受到我的良苦用心。加油 +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" index 5eb5127a93..61d49b5297 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\345\271\266\346\237\245\351\233\206\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -105,13 +105,13 @@ bool isSame(int u, int v) { 搜索过程像是一个多叉树中从叶子到根节点的过程,如图: -![](https://file.kamacoder.com/pics/20230602102619.png) +![](https://file1.kamacoder.com/i/algo/20230602102619.png) 如果这棵多叉树高度很深的话,每次find函数 去寻找根的过程就要递归很多次。 我们的目的只需要知道这些节点在同一个根下就可以,所以对这棵多叉树的构造只需要这样就可以了,如图: -![](https://file.kamacoder.com/pics/20230602103040.png) +![](https://file1.kamacoder.com/i/algo/20230602103040.png) 除了根节点其他所有节点都挂载根节点下,这样我们在寻根的时候就很快,只需要一步, @@ -226,7 +226,7 @@ join(3, 2); 此时构成的图是这样的: -![](https://file.kamacoder.com/pics/20230525111307.png) +![](https://file1.kamacoder.com/i/algo/20230525111307.png) 此时问 1,3是否在同一个集合,我们调用 `join(1, 2); join(3, 2);` 很明显本意要表示 1,3是在同一个集合。 @@ -256,7 +256,7 @@ join(3, 2); 构成的图是这样的: -![](https://file.kamacoder.com/pics/20230525112101.png) +![](https://file1.kamacoder.com/i/algo/20230525112101.png) 因为在join函数里,我们有find函数进行寻根的过程,这样就保证元素 1,2,3在这个有向图里是强连通的。 @@ -275,12 +275,12 @@ join(3, 2); 1、`join(1, 8);` -![](https://file.kamacoder.com/pics/20231122112727.png) +![](https://file1.kamacoder.com/i/algo/20231122112727.png) 2、`join(3, 8);` -![](https://file.kamacoder.com/pics/20231122113857.png) +![](https://file1.kamacoder.com/i/algo/20231122113857.png) 有录友可能想,`join(3, 8)` 在图中为什么 将 元素1 连向元素 3 而不是将 元素 8 连向 元素 3 呢? @@ -288,12 +288,12 @@ join(3, 2); 3、`join(1, 7);` -![](https://file.kamacoder.com/pics/20231122114108.png) +![](https://file1.kamacoder.com/i/algo/20231122114108.png) 4、`join(8, 5);` -![](https://file.kamacoder.com/pics/20231122114847.png) +![](https://file1.kamacoder.com/i/algo/20231122114847.png) 这里8的根是3,那么 5 应该指向 8 的根 3,这里的原因,我们在上面「常见误区」已经讲过了。 但 为什么 图中 8 又直接指向了 3 了呢? @@ -310,11 +310,11 @@ int find(int u) { 5、`join(2, 9);` -![](https://file.kamacoder.com/pics/20231122115000.png) +![](https://file1.kamacoder.com/i/algo/20231122115000.png) 6、`join(6, 9);` -![](https://file.kamacoder.com/pics/20231122115404.png) +![](https://file1.kamacoder.com/i/algo/20231122115404.png) 这里为什么是 2 指向了 6,因为 9的根为 2,所以用2指向6。 @@ -347,13 +347,13 @@ rank表示树的高度,即树中结点层次的最大值。 例如两个集合(多叉树)需要合并,如图所示: -![](https://file.kamacoder.com/pics/20230602172250.png) +![](https://file1.kamacoder.com/i/algo/20230602172250.png) 树1 rank 为2,树2 rank 为 3。那么合并两个集合,是 树1 合入 树2,还是 树2 合入 树1呢? 我们来看两个不同方式合入的效果。 -![](https://file.kamacoder.com/pics/20230602172933.png) +![](https://file1.kamacoder.com/i/algo/20230602172933.png) 这里可以看出,树2 合入 树1 会导致整棵树的高度变的更高,而 树1 合入 树2 整棵树的高度 和 树2 保持一致。 @@ -454,3 +454,4 @@ void join(int u, int v) { 敬请期待 并查集题目精讲系列。 +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" index 96e313fc42..718f5484a1 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\345\271\277\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -18,11 +18,11 @@ 我们用一个方格地图,假如每次搜索的方向为 上下左右(不包含斜上方),那么给出一个start起始位置,那么BFS就是从四个方向走出第一步。 -![图一](https://file.kamacoder.com/pics/20220825104505.png) +![图一](https://file1.kamacoder.com/i/algo/20220825104505.png) 如果加上一个end终止位置,那么使用BFS的搜索过程如图所示: -![图二](https://file.kamacoder.com/pics/20220825102653.png) +![图二](https://file1.kamacoder.com/i/algo/20220825102653.png) 我们从图中可以看出,从start起点开始,是一圈一圈,向外搜索,方格编号1为第一步遍历的节点,方格编号2为第二步遍历的节点,第四步的时候我们找到终止点end。 @@ -30,7 +30,7 @@ 而且地图还可以有障碍,如图所示: -![图三](https://file.kamacoder.com/pics/20220825103900.png) +![图三](https://file1.kamacoder.com/i/algo/20220825103900.png) 在第五步,第六步 我只把关键的节点染色了,其他方向周边没有去染色,大家只要关注关键地方染色的逻辑就可以。 @@ -102,3 +102,4 @@ void bfs(vector>& grid, vector>& visited, int x, int y 相信看完本篇,大家会对广搜有一个基础性的认识,后面再来做对应的题目就会得心应手一些。 +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\346\200\273\347\273\223\347\257\207.md" "b/problems/kamacoder/\345\233\276\350\256\272\346\200\273\347\273\223\347\257\207.md" index d89d6411e9..d7b8da94cb 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\346\200\273\347\273\223\347\257\207.md" @@ -143,3 +143,4 @@ kruscal的主要思路: 图论也是我 《代码随想录》所有章节里 所费精力最大的一个章节。 只为了不负录友们的期待。 大家加油💪🏻 +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" index 1611e00aa0..50df8aa6df 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\346\267\261\346\220\234\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -28,29 +28,29 @@ 如图一,是一个无向图,我们要搜索从节点1到节点6的所有路径。 -![图一](https://file.kamacoder.com/pics/20220707093643.png) +![图一](https://file1.kamacoder.com/i/algo/20220707093643.png) 那么dfs搜索的第一条路径是这样的: (假设第一次延默认方向,就找到了节点6),图二 -![图二](https://file.kamacoder.com/pics/20220707093807.png) +![图二](https://file1.kamacoder.com/i/algo/20220707093807.png) 此时我们找到了节点6,(遇到黄河了,是不是应该回头了),那么应该再去搜索其他方向了。 如图三: -![图三](https://file.kamacoder.com/pics/20220707094011.png) +![图三](https://file1.kamacoder.com/i/algo/20220707094011.png) 路径2撤销了,改变了方向,走路径3(红色线), 接着也找到终点6。 那么撤销路径2,改为路径3,在dfs中其实就是回溯的过程(这一点很重要,很多录友不理解dfs代码中回溯是用来干什么的) 又找到了一条从节点1到节点6的路径,又到黄河了,此时再回头,下图图四中,路径4撤销(回溯的过程),改为路径5。 -![图四](https://file.kamacoder.com/pics/20220707094322.png) +![图四](https://file1.kamacoder.com/i/algo/20220707094322.png) 又找到了一条从节点1到节点6的路径,又到黄河了,此时再回头,下图图五,路径6撤销(回溯的过程),改为路径7,路径8 和 路径7,路径9, 结果发现死路一条,都走到了自己走过的节点。 -![图五](https://file.kamacoder.com/pics/20220707094813.png) +![图五](https://file1.kamacoder.com/i/algo/20220707094813.png) 那么节点2所连接路径和节点3所链接的路径 都走过了,撤销路径只能向上回退,去选择撤销当初节点4的选择,也就是撤销路径5,改为路径10 。 如图图六: -![图六](https://file.kamacoder.com/pics/20220707095232.png) +![图六](https://file1.kamacoder.com/i/algo/20220707095232.png) 上图演示中,其实我并没有把 所有的 从节点1 到节点6的dfs(深度优先搜索)的过程都画出来,那样太冗余了,但 已经把dfs 关键的地方都涉及到了,关键就两点: @@ -180,7 +180,7 @@ for (选择:本节点所连接的其他节点) { 如图七所示, 路径2 已经走到了 目的地节点6,那么 路径2 是如何撤销,然后改为 路径3呢? 其实这就是 回溯的过程,撤销路径2,走换下一个方向。 -![图七](https://file.kamacoder.com/pics/20220708093544.png) +![图七](https://file1.kamacoder.com/i/algo/20220708093544.png) ## 总结 @@ -194,3 +194,4 @@ for (选择:本节点所连接的其他节点) { 后面我也会给大家安排具体练习的题目,依旧是代码随想录的风格,循序渐进由浅入深! +
diff --git "a/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" index 9bec322765..fb52c83921 100644 --- "a/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/kamacoder/\345\233\276\350\256\272\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -17,15 +17,15 @@ 有向图是指 图中边是有方向的: -![](https://file.kamacoder.com/pics/20240510195737.png) +![](https://file1.kamacoder.com/i/algo/20240510195737.png) 无向图是指 图中边没有方向: -![](https://file.kamacoder.com/pics/20240510195451.png) +![](https://file1.kamacoder.com/i/algo/20240510195451.png) 加权有向图,就是图中边是有权值的,例如: -![](https://file.kamacoder.com/pics/20240510195821.png) +![](https://file1.kamacoder.com/i/algo/20240510195821.png) 加权无向图也是同理。 @@ -35,7 +35,7 @@ 例如,该无向图中,节点4的度为5,节点6的度为3。 -![](https://file.kamacoder.com/pics/20240511115029.png) +![](https://file1.kamacoder.com/i/algo/20240511115029.png) 在有向图中,每个节点有出度和入度。 @@ -45,7 +45,7 @@ 例如,该有向图中,节点3的入度为2,出度为1,节点1的入度为0,出度为2。 -![](https://file.kamacoder.com/pics/20240511115235.png) +![](https://file1.kamacoder.com/i/algo/20240511115235.png) ## 连通性 @@ -56,11 +56,11 @@ 在无向图中,任何两个节点都是可以到达的,我们称之为连通图 ,如图: -![](https://file.kamacoder.com/pics/20240511102351.png) +![](https://file1.kamacoder.com/i/algo/20240511102351.png) 如果有节点不能到达其他节点,则为非连通图,如图: -![](https://file.kamacoder.com/pics/20240511102449.png) +![](https://file1.kamacoder.com/i/algo/20240511102449.png) 节点1 不能到达节点4。 @@ -72,7 +72,7 @@ 我们来看这个有向图: -![](https://file.kamacoder.com/pics/20240511104531.png) +![](https://file1.kamacoder.com/i/algo/20240511104531.png) 这个图是强连通图吗? @@ -82,7 +82,7 @@ 下面这个有向图才是强连通图: -![](https://file.kamacoder.com/pics/20240511113101.png) +![](https://file1.kamacoder.com/i/algo/20240511113101.png) ### 连通分量 @@ -91,7 +91,7 @@ 只看概念大家可能不理解,我来画个图: -![](https://file.kamacoder.com/pics/20240511111559.png) +![](https://file1.kamacoder.com/i/algo/20240511111559.png) 该无向图中 节点1、节点2、节点5 构成的子图就是 该无向图中的一个连通分量,该子图所有节点都是相互可达到的。 @@ -111,7 +111,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240511112951.png) +![](https://file1.kamacoder.com/i/algo/20240511112951.png) 节点1、节点2、节点3、节点4、节点5 构成的子图是强连通分量,因为这是强连通图,也是极大图。 @@ -132,11 +132,11 @@ 例如图: -![](https://file.kamacoder.com/pics/20240511112951.png) +![](https://file1.kamacoder.com/i/algo/20240511112951.png) 图中有8条边,我们就定义 8 * 2的数组,即有n条边就申请n * 2,这么大的数组: -![](https://file.kamacoder.com/pics/20250110114348.png) +![](https://file1.kamacoder.com/i/algo/20250110114348.png) 数组第一行:6 7,就表示节点6 指向 节点7,以此类推。 @@ -162,7 +162,7 @@ 如图: -![](https://file.kamacoder.com/pics/20240222110025.png) +![](https://file1.kamacoder.com/i/algo/20240222110025.png) 在一个 n (节点数)为8 的图中,就需要申请 8 * 8 这么大的空间。 @@ -188,7 +188,7 @@ 邻接表的构造如图: -![](https://file.kamacoder.com/pics/20240223103713.png) +![](https://file1.kamacoder.com/i/algo/20240223103713.png) 这里表达的图是: @@ -246,3 +246,4 @@ dfs 和 bfs 一种搜索算法,可以在不同的数据结构上进行搜索 敬请期待! +
diff --git "a/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" "b/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" index e83880dab1..194f1f5ee2 100644 --- "a/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/kamacoder/\346\234\200\347\237\255\350\267\257\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" @@ -17,7 +17,7 @@ 最短路算法比较复杂,而且各自有各自的应用场景,我来用一张表把讲过的最短路算法的使用场景都展现出来: -![](https://file.kamacoder.com/pics/20240508121355.png) +![](https://file1.kamacoder.com/i/algo/20240508121355.png) (因为A * 属于启发式搜索,和上面最短路算法并不是一类,不适合一起对比,所以没有放在一起) @@ -51,3 +51,4 @@ +
diff --git a/problems/qita/acm.md b/problems/qita/acm.md index 33dcd8a652..d4d942daca 100644 --- a/problems/qita/acm.md +++ b/problems/qita/acm.md @@ -11,15 +11,15 @@ [知识星球](https://programmercarl.com/other/kstar.html)里很多录友的日常打卡中,都表示被 ACM模式折磨过: -
+
-
+
-
+
-
+
-
+
所以我正式推出:**卡码网**([https://kamacoder.com](https://kamacoder.com)),**专门帮助大家练习ACM模式**。 @@ -43,17 +43,17 @@ 来看看这极简的界面,没有烂七八糟的功能,只有刷题! -
+
在「状态」这里可以看到 大家提交的代码和判题记录,目前卡码网([https://kamacoder.com](https://kamacoder.com))几乎无时无刻都有卡友在提交代码。 看看大家周六晚上都在做什么,刷哪些题目。 -
+
提交代码的界面是这样的,**目前支持所有主流刷题语言**。 -
+
## 题解 @@ -63,7 +63,7 @@ [https://github.com/youngyangyang04/kamacoder-solutions](https://github.com/youngyangyang04/kamacoder-solutions) -
+
**欢迎去Github上star,欢迎fork,也欢迎来Github仓库贡献其他语言版本,成为contributor**。 @@ -71,7 +71,7 @@ 目前已经有两位录友贡献C和Java版本了。 -
+
期待在Github(https://github.com/youngyangyang04/kamacoder-solutions) 的contributors上也出现你的头像。 diff --git a/problems/qita/acm_backup.md b/problems/qita/acm_backup.md new file mode 100755 index 0000000000..d4d942daca --- /dev/null +++ b/problems/qita/acm_backup.md @@ -0,0 +1,89 @@ + +# 如何练习ACM模式输入输出模式 | 如何准备笔试 | 卡码网 + +卡码网地址:[https://kamacoder.com](https://kamacoder.com) + +## 为什么卡码网 + +录友们在求职的时候会发现,很多公司的笔试题和面试题都是ACM模式, 而大家习惯去力扣刷题,力扣是核心代码模式。 + +当大家在做ACM模式的算法题的时候,需要自己处理数据的输入输出,**如果没有接触过的话,还是挺难的**。 + +[知识星球](https://programmercarl.com/other/kstar.html)里很多录友的日常打卡中,都表示被 ACM模式折磨过: + +
+ +
+ +
+ +
+ +
+ +所以我正式推出:**卡码网**([https://kamacoder.com](https://kamacoder.com)),**专门帮助大家练习ACM模式**。 + +那么之前大家去哪里练习ACM模式呢? + +去牛客做笔试真题,结果发现 ACM模式没练出来,题目倒是巨难,一点思路都没有,代码更没有写,ACM模式无从练起。 + +去洛谷,POJ上练习? 结果发现 题目超多,不知道从哪里开始刷,也没有一个循序渐进的刷题顺序。 + +**而卡码网上有我精选+制作的25道题目**!我还把25题的后台测试数据制作了一遍,保证大家练习的效果。 + +为什么题目不多,只有25道? + +因为大家练习ACM模式不需要那么多题目,有一个循序渐进的练习过程就好了。 + +这25道题目包含了数组、链表、哈希表、字符串、二叉树、动态规划以及图的的题目,常见的输入输出方式都覆盖了。 + +**这是最精华的25道题目**!。 + +## 卡码网长什么样 + +来看看这极简的界面,没有烂七八糟的功能,只有刷题! + +
+ +在「状态」这里可以看到 大家提交的代码和判题记录,目前卡码网([https://kamacoder.com](https://kamacoder.com))几乎无时无刻都有卡友在提交代码。 +看看大家周六晚上都在做什么,刷哪些题目。 + +
+ + +提交代码的界面是这样的,**目前支持所有主流刷题语言**。 + +
+ +## 题解 + +基本大家来卡码网([https://kamacoder.com](https://kamacoder.com))练习ACM模式,都是对输入输出不够了解的,所以想看现成的题解,看看究竟是怎么处理的。 + +所以我用C++把卡码网上25道题目的题解都写了,并发布到Github上: + +[https://github.com/youngyangyang04/kamacoder-solutions](https://github.com/youngyangyang04/kamacoder-solutions) + +
+ +**欢迎去Github上star,欢迎fork,也欢迎来Github仓库贡献其他语言版本,成为contributor**。 + +如果不懂如何和开源项目提交代码,[可以看这里](https://www.programmercarl.com/qita/join.html) + +目前已经有两位录友贡献C和Java版本了。 + +
+ +期待在Github(https://github.com/youngyangyang04/kamacoder-solutions) 的contributors上也出现你的头像。 + +目前题解只有C++代码吗? + +当然不是,大多数题目已经有了 Java、python、C版本。 **其他语言版本,就给录友们成为contributor的机会了**。 + +## 最后 + +卡码网地址:[https://kamacoder.com](https://kamacoder.com) + +快去体验吧,笔试之前最好 把卡码网25道题目都刷完。 + +期待录友们成为最早一批把卡码网刷爆的coder! + diff --git a/problems/qita/algo_pdf.md b/problems/qita/algo_pdf.md new file mode 100755 index 0000000000..76e2d16af1 --- /dev/null +++ b/problems/qita/algo_pdf.md @@ -0,0 +1,70 @@ +# 代码随想录完整版PDF下载 | 合集下载 | 百度云 | + +代码随想录已经是很多学习算法的小伙伴刷题必备的资料,也得到非常多的好评,这是Carl继续创作的动力。 + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +估计绝大多数录友之前也都下载过代码随想录PDF,但是那是我两年前整理的了。 + +![](https://file1.kamacoder.com/i/algo/20230815200530.png) + +如今,很多题目的讲解都改了上十遍,很多图都重画过。 + +之前的PDF一直都没有全集,而且章节也不全,主要是重点章节:二叉树、回溯算法、贪心、动态规划的整理。 + +也有太多录友和我反馈过:由于XXX原因,自己不能上网,看不了网站,pdf有完整版吗? + +其实录友们的需求我都记下来了,就是工作太多,我只能慢慢一项一项去处理。 + +**虽然慢,但我一直在做**! + +现在代码随想录网站最新的内容以及全集整理完毕。 + +
+ +这份PDF整理的非常精细,并把我的[算法公开课](./gongkaike.md)视频,对应题目的链接都放上去了: + +
+ +这份《代码随想录》PDF 和 《代码随想录》纸质版 和 代码随想录网站基本一致,大家选一个合适自己的阅读方式就好。 + +不过这里我依然建议大家尽量看代码随想录网站(programmercarl.com),因为网站一直都是最新的,也是经常更新的。 + +PDF可以作为辅助,例如不能上网的时候。 + +昨天我在[知识星球](./kstar.md)里第一时间公布这份全版代码随想录PDF下载的消息 + +
+ +同时有我企业微信的录友,都接到了这份PDF的推送: + +
+ +
+ +
+ +
+ +
+ +现在我把它免费分享给录友们,大家可以加我的企业微信,备注:简单自我介绍+pdf ,例如:XX大学研二-pdf 或者 XX城市后端开发-pdf ,通过之后,会直接发给大家的。 + +
+ + + diff --git a/problems/qita/ewaishuoming.md b/problems/qita/ewaishuoming.md new file mode 100755 index 0000000000..7c3f690368 --- /dev/null +++ b/problems/qita/ewaishuoming.md @@ -0,0 +1,16 @@ + + +# 本模块说明 + +本模块题目,暂时没有纳入「代码随想录」算法教程体系之中。 + +* 本模块部分题解还不够完善。 +* 本模块部分题目和「代码随想录」中是相似的。 +* 本模块题解并没有体系化 + +很多录友反馈,除了「代码随想录」还有没有其他题目可以练手,最好也有题解,所以我才把这些题解放出来。本模块题目可以作为大家刷题的一个补充。 + +加油💪 + + + diff --git a/problems/qita/gongkaike.md b/problems/qita/gongkaike.md new file mode 100755 index 0000000000..26c874b0c8 --- /dev/null +++ b/problems/qita/gongkaike.md @@ -0,0 +1,162 @@ + +# 代码随想录算法公开课 | 最强算法公开课 + +和录友们汇报一下,**代码随想录算法公开课**已经更新完毕了。 + +由我亲自录制了140期算法视频,覆盖了 [《代码随想录》纸质版](./publish.md)上全部题目的讲解。 + +视频全部免费开放在[B站:代码随想录](https://www.bilibili.com/video/BV1fA4y1o715) + +目录就在视频播放的右边,完全按照代码随想录的顺序讲解,配合 《代码随想录》或者代码随想录网站一起学习,味道更佳! + +
+ +从在22年的5月份开始决定把《代码随想录》上的算法题都由我亲自讲解一波。 + +当时录了第一期算法视频 「二分查找」: + +
+ +别看现在这期视频有10w的播放量,因为都是后序录友们自己找到我的视频来看的,一年后才到10w播放。 + +当时这个视频发出去,播放量就几百。 + +毕竟这种算法视频和普通娱乐或者范技术类视频没法比,平台也不会推荐的。 + +我的视频播放量虽然低,但只要看过视频的录友,评论都很高。随便找了几个最新的评论: + +![](https://file1.kamacoder.com/i/algo/20221121094718.png) + +![](https://file1.kamacoder.com/i/algo/20230222100337.png) + +![](https://file1.kamacoder.com/i/algo/20230222113111.png) + +![](https://file1.kamacoder.com/i/algo/20230222163023.png) + +![](https://file1.kamacoder.com/i/algo/20230223235500.png) + +![](https://file1.kamacoder.com/i/algo/20230323211739.png) + +![](https://file1.kamacoder.com/i/algo/20230324150536.png) + +![](https://file1.kamacoder.com/i/algo/20230325215454.png) + +![](https://file1.kamacoder.com/i/algo/20230327100147.png) + +![](https://file1.kamacoder.com/i/algo/20230329101702.png) + +![](https://file1.kamacoder.com/i/algo/20230404202808.png) + +当初也是看到大家的评论,我才下决心继续更下去,从 去年5月份,每周坚持更新四期算法视频,雷打不动,一直坚持到现在。 + +![](https://file1.kamacoder.com/i/algo/20230303170120.png) + +一晃 ,大半年过去了,足足更新了 140期算法视频,已经覆盖了 [《代码随想录》纸质版](./publish.md)上全部题目的讲解。 + +**我应该为数不多(至少目前我还没看到)的技术书籍作者能亲自把书中全部内容以视频的方式讲解出来并免费分享给大家的** + +大家可以想一想这些年买过哪些技术书籍,有作者亲自给大家把每章每一节都做视频讲解并免费开放的。 + +**那么看 [《代码随想录》](./publish.md)的录友们就有这个待遇**! + +讲课录视频,其实是很费精力的,大家看视频,可能看我讲的行云流水,其实我都是做了十足的功课。 + +**我平时养成了只要有空的时候就模拟一遍某算法运行过程的习惯,板书更是擦了写写了再擦**,反复尝试那种方式能给大家讲清楚的,然后再开拍视频。 + +可能大家会想,都出书了照着书讲不就好了吗? 应该不难吧? + +如果这么简单的话,可能市面上 很多技术书籍作者们就都亲自讲解一波了。 + +写出来和讲出来还不是一个维度。 + +讲出来需要很综合的能力包括表达力,而且大家看我的算法视频会发现:我是脱稿的,我没有提示词,摄像头开了就开讲 一镜到底。 + +**我是做了非常多练习才达到这个程度**。 + +很多人看到摄像头,就会紧张,没有提示词就不知道自己下句该说什么了,瞬间就会:我是谁,我在哪,我在干什么? + +## 算法公开课质量如何 + +目前国内算法视频的讲解风格,一般是 录屏力扣写代码 或者 ppt演示。 这样其实录制视频难度低了很多。 + +但大家上油管的话,会发现 海外经典算法视频的up ,都是一个小白板直接开讲。 + +
+
+
+ +这种讲课方式 容易走两个极端,**一种就是非常好,成为经典系列,一种就是被喷讲的像垃圾一样**。 + +如果是 录屏或者ppt演示,这样至少有稿件照着读,或者提示词,就算差也不会差到哪去。 + +所以呢,我选择这种白板模拟思路直接手撕代码的讲课方式,也是给自己一个挑战,目前的口碑来看,还有走向了好的那个极端。 + + +关于质量究竟如何,学习效果如何,大家可以去B站上去看(B站同名:[代码随想录](https://www.bilibili.com/video/BV1fA4y1o715)),有口皆碑! + + +## 辛苦录视频为了啥 + +再说说这个辛苦录视频,一忙就忙大半年,投入这么多时间和精力,最后为什么还免费开放。 + +书 + 付费视频讲解 或者 免费网站内容 + 付费视频讲解 或者 免费网站内容 + 部分视频免费 + 部分视频付费,**这些都是非常好的盈利模式**,而且还可持续变现的。 + +以代码随想录目前的影响力来说,我这套140集视频教程,不用很贵,定价99元,每年卖出上万份问题不大。 + +这可是一笔非常可观的收入!(真的很香!)而且还是持续收入,后期还不用什么去维护,不像 [知识星球](./kstar.md) 或者 [算法训练营](./xunlianying.md) 我需要花大量时间给录友们答疑。 + +那我为什么不这么做呢? + +**“代码随想录” 这五个字,我是会用一生去经营的**,凡事要看的长远,不是什么赚钱就立刻要去干什么。 + +这套算法公开课视频,不仅造福录友们,也放大了代码随想录的品牌影响,这是双赢的。 + +**免费硬核的算法内容是 代码随想录的立身之本**,也是 大家为什么学算法学编程首选代码随想录的根本所在。 + +如果有点影响力了,就暗插各种付费,这样不持久! **也会伤了很多录友的心**。 + +所以目前 代码随想录网站(programmercarl.com),代码随想录Github(https://github.com/youngyangyang04/leetcode-master),代码随想录算法公开课(B站:代码随想录),**都是完全免费**,也足够大家学习算法所用。 + +**我的免费算法视频内容,要比绝大多数视频上大家付费的 算法视频课、算法训练营质量要高得多**,视频课程基于《代码随想录》的刷题顺序来录制,会让视频内容非常系统,而不是东一块,西一块的。 + +至于《代码随想录》纸质版的内容其实和代码随想录网站是一样的,很的录友买纸质版是因为习惯看纸质版,有的是仅仅是为了留念和收藏。 + +而且以上开源内容,我还会持续优化迭代的,不会做完了就放着不管,如果一年前刷完代码随想录的录友现在在重看一遍 代码随想录网站,**你会发现很多题解了又多了很多图,又优化了很多讲解内容**。 + +这是我的github提交记录:(https://github.com/youngyangyang04) + +
+ +每天或多或少多要优化一点点。 **每天的量可能不多,但每天都在优化**! + +如果感觉代码随想录网站 和 代码随想录算法公开课对大家确实有帮助,不用买书,欢迎去[豆瓣](https://book.douban.com/subject/35680544/)给一个好评就好,感谢录友们的支持。 + + +## 公开课 + +再回头说说目前算法公开课, 其实直到现在 我新发的视频播放也就两三千的播放量。 + +
+ +(大家现在去B站上去看,可能已经上万播放量,但新发的时候 播放量一直都很惨淡) + +但为什么发视频就两三千播放量,就可以在B站聚集10w录友。 + +
+ +对于B站十万粉的号主来说,好像都得有几个百万播放的爆款视频。 + +**但我的视频从来没有爆款过,也没有被平台推荐过,都是非常稳定的几千播放**。 + +很多录友都是主动搜索找过来的就关注了,或者身边的人推荐来的。 + +只要是真正能给大家带来价值的,真正能让大家学明白算法,就会得到认可。 + +所以,**酒香不怕巷子深,真正有价值的内容,不需要蹭热点,想学习的人一定会找到你**。 + +目前《代码随想录》上的算法讲解视频终于更新完了,后面有就有足够的精力去更图论、排序、高级数据结构了。 + +算法公开课全部发布在B站上,链接直达:[《代码随想录》算法公开课](https://www.bilibili.com/video/BV1fA4y1o715) + +最后,**认准代码随想录,学习算法不迷路**。加油💪🏻 + diff --git a/problems/qita/join.md b/problems/qita/join.md index 027b81726a..232d84ca2f 100644 --- a/problems/qita/join.md +++ b/problems/qita/join.md @@ -28,10 +28,10 @@ 点击这里Fetch upstream。 -
+
点击之后,这里就会显示最新的信息了 -
+
注意这时是你的远端仓库为最新版本,本地还不是最新的,本地要git pull一下。 @@ -39,18 +39,18 @@ 如何提交代码呢,首先把自己的代码提交到自己的fork的远端仓库中,然后open pull request,如图: -
+
点击 open pull request之后,就是如下画面,一个pull request有多个commit。 -
+
然后就是给pull request 添加备注,pull request是对本次commit的一个总结。如果一个pull request就一个commit,那么就和commit的备注保持一次。 然后点击 create pull request 就可以了 -
+
此时你就提交成功了,我会在项目中的pull requests 处理列表里看到你的请求。 -
+
然后如果你发现自己的代码没有合入多半是有问题,如果有问题都有会在pull request里给出留言的, @@ -78,27 +78,27 @@ C++代码 \`\`\` 例如这个commit,在添加java代码的时候,就直接添加代码 -
+
正确的格式应该是这样: -
+
一般发现问题,我也会在代码中给出评论: -
+
这样大家也可以学习一些 提交代码的规范方面的知识 有的录友 是添加的代码块语法,但没有标记是哪种语言,这样的话 代码就不会针对某种语言高亮显示了,也比较影响阅读,例如: -
+
提交python代码的话,要注释好,是python2还是python3 例如这样: -
+
当然python2的话,只这么写就行 @@ -113,7 +113,7 @@ python代码 有的录友是一个pull request 里只有一个commit。 -
+
其实如果大家是平时一天写了两三道题目的话,那么分三个commit,一个pull request提交上来就行。 @@ -127,13 +127,13 @@ python代码 例如这位录友,在提交Java代码的时候,按照题解的意思对Java版本的代码进行的注释,这就很棒👍 -
+
-
+
当然如果大家感觉 已有的代码 不符合以上要求的话,例如 代码思路不够清晰不够规范,注释不够友好,依然欢迎提交优化代码,要记得详细注释哦。 -
+
### 说明具体是哪种方法 @@ -141,10 +141,10 @@ python代码 下面这位录友做的就很好 -
+
-
+
有的题解,是一起给出了多道题目的讲解,例如项目中0102.二叉树的层序遍历.md 中有八道题目,那么大家添加代码的时候 应该在代码注释上,或者 直接写上 是哪个题目的代码。 @@ -162,7 +162,7 @@ python代码 有一位录友在提交代码的时候会把之前的代码 做一下规范性的调整,这就很棒。 -
+
**代码规范从你我做起!** @@ -183,10 +183,10 @@ python代码 在合入的过程中还要处理冲突的代码, 理解大家代码的思路,解决冲突,然后在力扣提交一下,确保是没问题。 例如同一道题目, 一位录友提交了, 我还没处理如何,另一位录友也对这道题也提交了代码,这样就会发生冲突 -
+
大家提交代码的热情太高了,我有时候根本处理不过来,但我必须当天处理完,否则第二天代码冲突会越来越多。 -
+
一天晚上分别有两位录友提交了 30多道 java代码,全部冲突,解决冲突处理的我脖子疼[哭] @@ -201,11 +201,11 @@ python代码 确保这种额外文件不要提交。 -
+
还有添加不同方法的时候,直接用正文格式写,哪种方法就可以了,不要添加目录 ,例如这样,这样整篇文章目录结构就有影响了。 -
+
前面不要加 `## 前序遍历(迭代法)`,直接写`前序遍历(迭代法)`就可以了。 @@ -233,11 +233,11 @@ Go语言代码 甚至发现哪里有语病,也欢迎提交PR来修改,例如下面:就是把【下表】 纠正为【下标】 -
+
不用非要写出牛逼的代码才能提交PR,只要发现 文章中有任何问题,或者错别字,都欢迎提交PR,成为contributor。 -
+
## 特别注意 diff --git a/problems/qita/language.md b/problems/qita/language.md new file mode 100755 index 0000000000..625154e0a5 --- /dev/null +++ b/problems/qita/language.md @@ -0,0 +1,22 @@ + +# 编程语言基础课 + +「代码随想录」的内容是完全免费的。 + +**不过不少录友是编程零基础**,而刷「代码随想录」至少默认你是会一定的编程语言知识的。 + +如果你是编程零基础,又想快速达到刷算法题(或者说刷代码随想录)所需编程语言的水平,推荐 + +* [C++基础课](../ke/cplus.md) +* [Java基础课](../ke/java.md) +* [Python基础课](../ke/python.md) +* [Go基础课](../ke/go.md) +* [Javascript基础课](../ke/js.md) + +如果你有一定数据结构算法知识,想用数据结构做一个小项目的话,推荐: + +* [手写STL(C++)](../ke/stl.md) +* [kv存储-CPP](../ke/kvcplus.md) +* [kv存储-JAVA](../ke/java.md) + + diff --git a/problems/qita/publish.md b/problems/qita/publish.md new file mode 100755 index 0000000000..5a57ec4e4b --- /dev/null +++ b/problems/qita/publish.md @@ -0,0 +1,200 @@ +# 十年所学,终成《代码随想录》 + +**《代码随想录》终于终于正式出版上市了!** (文末附购买链接,直接五折!) + +[B站介绍](https://www.bilibili.com/video/BV13L4y1E7s4/) + +最近这一年不少录友都问我,代码随想录什么时候出版啊? + +**其实我比大家还期待这一刻的到来!** + +先奉上几张书照片:(封面最终选定为梵高的画作,阿姆斯特丹,圣马迪拉莫,1888,海景) + +
+ +
+ +其实在去年,也就是2020年我就已经将这本书的内容写好了,本以为可以很快出版,但我还是严重低估了写书的工作量。 + +因为自己对质量的追求,一直在不断打磨,所以又是一年快过去了。 + +**《代码随想录》总共将近500页,70w字,200多个插图,真的处处都是心血**。 + +出书是一件浩大工程,比写文章难太多了,**真的字字斟酌,大家看书里可能平平淡淡的一句话、一个词语、一个概念,我可能就查阅很多资料,反复推敲:表达是否准确,用词是否到位,生怕辜负了大家的期待**。 + +这是我自己平时书桌的场景: + +
+ +这两年可以说我没有什么娱乐活动,业余生活极其枯燥,都花费在这本书上了,其中艰辛只有自己知道。 + +而此时当大家都能看到《代码随想录》这部作品的时候,其满足感对我来说已经足以。 + +写这本书用了两年,**而真正消化、理解、研究这些算法知识,我用了整整十年**,十年前我就开始写算法文章,妄图闯进算法的大门,这一写就是十年。 + +
+ +**真的是十年所学,两年打磨,终成《代码随想录》!** + +所以当坚持一件事情的时候,一年、两年,甚至三年、五年,不足以看出其效果,但也许坚持十年的时候,才等到真正收获的时刻。 + +## 代码随想录的故事 + +《代码随想录》不是两年憋大招来个横空出世。 + +而是一点一点打磨出来的,其刷题顺序、题解内容、思考深度 都是经过了上10w录友的共同见证。 + +也正是这些内容,把大家汇聚在一起,一起攻克算法的一座又一座高山。 + +与此同时,也几乎每天都会有录友来专门私信我来表达自己的感激: + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +这些都是大家与“代码随想录”之间的故事,也欢迎大家在文章留言,说一说自己和 “代码随想录”之间的故事。 + +## 《代码随想录》有何不同? + +大家在学习编程、算法,刷题的时候,**真正的苦恼在于没有一套行之有效的刷题顺序**。 + +从何学起,先学什么,再学什么。力扣(Leetcode)上两千道题目,怎么刷,很多人刷题的效率低,主要体现在如下三点: + +* 找题 +* 找到了不合适现阶段做的题 +* 没有全套的优质题解可以参考 + +而市面上基本找不到真正能解决以上痛点的算法书籍。 + +一些书籍是每个知识点蜻蜓点水,然后就叫大家举一反三。 + +一些书籍是一堆题解堆在一起,让大家学起来感受不到知识的连贯性和系统性。 + +断片式的学习,效率怎么能高呢? + +当初我在学习算法的时候,就深感其中的艰难,当我的题量达到一定数量时候,随着反复的琢磨和深入的思考,我再去回顾这些算法题目,**发现如果要是按照合理的顺序来刷题,那效果一定是 事半功倍!** + +所以我将每一个专题中的**题目按照由易到难的顺序进行编排,每一道题目所涉及的知识,前面都会有相应的题目做知识铺垫,做到环环相扣**。 + +**建议大家按照章节顺序阅读本书**,在阅读的过程中会发现我在题目编排上的良苦用心! + +本书不仅在题目编排上精心设计,而且在针对读者最头痛的算法问题上做了详细且深入的讲解。 + +* 关于动态规划,都知道递推公式的重要性,但dp数组的含义、dp数组的初始化、遍历顺序以及如何打印dp数组来排查Bug,这些都很重要。例如,解决背包问题的时候,遍历顺序才是最关键的,也是最难理解的。 + +* 关于回溯算法,题目要求集合之间不可重复,那么就需要去重,各种资料都说要去重,但没有说清楚是“树层去重”还是“树枝去重”——这是我为了说明去重的过程而创造的两个词汇。 + +* 关于KMP算法,都知道使用前缀表进行回退,可什么是前缀表,为什么一定要用前缀表,根据前缀表回退有几种方式,这些却没有说清楚,导致最后大家看的一头雾水。 + +* 关于二叉树,不同的遍历顺序其递归函数究竟如何安排,递归函数什么时候需要返回值,什么时候不用返回值,什么情况下分别使用前、中、后序遍历,迭代法又要如何实现,这些都决定了对二叉树的理解是否到位。 + +同时我针对每一个专题的特点,整理出其通用的解法套路。 + +例如: + +* 在二叉树专题中,总结了递归“三部曲”来帮助读者掌握二叉树中各种遍历方式的写法。 +* 回溯算法中的回溯“三部曲”可以帮助读者理解回溯算法晦涩难懂的过程。 +* 动态规划中的动规“五部曲”可以帮助读者在一套思考框架下去解决动态规划题目。 + +再来说一说动态规划,在程序员面试中,动态规划是公认的最难掌握的算法,也是出现频率最高的算法。 + +**如果仅仅讲解几道题目,即使再举一反三也远远达不到真正理解动态规划的程度**。 + +**如果把动态规划的题目单纯地堆砌在一起,也只会让人越学越懵,陷入“一看就会,一写就废”的怪圈**。 + +讲清楚一道题容易,讲清楚两道题也容易,但把整个动态规划的各个分支讲清楚,把每道题目讲透彻,并用一套方法论把整个动态规划的题目贯彻始终就有难度了。 + +**而帮助大家解决这个问题,这也是这本书的使命所在**。 + +购买方式,可以扫下方二维码,也可以直接[点击这里,京东直达](https://union-click.jd.com/jdc?e=&p=JF8BAMQJK1olXg8EUVhVCkkWAV8IGV8WVAICU24ZVxNJXF9RXh5UHw0cSgYYXBcIWDoXSQVJQwYAUF1UDEsQHDZNRwYlGFh6NVkPcRdyHWwMZRlLHlQDUj02eEcbM244GFIXWQYAUV5VOHsXBF9edVsUXAcDVVtdDUgnAl8IHFkdXw4BU1lfCkoRM2gIEmtIFVpKAxVtOHsUM184G2sWbURsUVpcCEMVAjgIHAxBWFYAAVdfXE8QBGkBGQsdCQEFVgttCkoWB2Y4) + +
+ + +## 目录 + +
+ +
+ +这里不少录友会问,书的内容和Github:https://github.com/youngyangyang04/leetcode-master,和网站:programmercarl.com 有什么区别呢? + +其实写文章相对来说是随意一些的,但书一定要非常严谨。 + +正如我本篇开头所说,书的内容其实一年前就写好的,但排版、纠错、打磨、重新画图,又花费了一年,所以书一定是更精细的,更严谨的。 + +**《代码随想录》的排版看起来非常舒服,会让你发现 原来学算法 会上瘾!** + +
+ +《代码随想录》的推荐语,我都是颇为用心,不是随随便便找个人写一写推荐语来凑数的。 + +
+ +哈工大计算机王院长,百度杰出架构师猛哥,腾讯专家工程师强哥,王道论坛创始人风华哥,**他们是在我学习工作的不同阶段里对我影响非常大的顶级巨佬**。 + +他们的学习方法,做事风格,都是值得每一位技术人学习。同时他们也是每一位技术人的榜样。 + +特别感谢巨佬们能在百忙之中阅读了本书的书稿,并给本书写了评语。 + +## 最后 + +我希望这本书,不仅仅是可以帮助大家学习编程,循序渐进的去学习算法,高效刷题,进大公司。 + +**同时 当你把这本书放在自己的书桌前,床头前的时候,它也会给你一种乘风破浪的勇气!** + +正如封面(梵高,阿姆斯特丹,圣马迪拉莫,1888,海景),一只帆船在波涛汹涌的大海里扬帆远航! + +《代码随想录》这就要和大家见面了,其实很多录友已经迫不及待: + +
+ +
+ +
+ +
+ +这本书原价还挺贵的(毕竟比较厚),但这里申请到了京东五折优惠,大家可以速度下手了。 + +点击下方链接直接五折购买,全网最低价格了。海外的录友们可以在等几天,广州有货之后,就可以配送的海外了。 + +《代码随想录》使用的语言是C++,使用其他语言的录友可以看本书的讲解思路,刷题顺序,然后配合看网站:programmercarl.com,网站上都对应的Java,Python,Go,Js,C,Swift版本 基本可以满足大家的学习需求。 + +购买方式,可以扫下方二维码,也可以直接[点击这里,京东直达](https://union-click.jd.com/jdc?e=&p=JF8BAMQJK1olXg8EUVhVCkkWAV8IGV8WVAICU24ZVxNJXF9RXh5UHw0cSgYYXBcIWDoXSQVJQwYAUF1UDEsQHDZNRwYlGFh6NVkPcRdyHWwMZRlLHlQDUj02eEcbM244GFIXWQYAUV5VOHsXBF9edVsUXAcDVVtdDUgnAl8IHFkdXw4BU1lfCkoRM2gIEmtIFVpKAxVtOHsUM184G2sWbURsUVpcCEMVAjgIHAxBWFYAAVdfXE8QBGkBGQsdCQEFVgttCkoWB2Y4) + +
+ +最后也感谢录友们的陪伴,真心希望大家都有一个好的前程! + +正如《代码随想录》正式出版一样,**你所期盼,终将到来! 加油💪** + + diff --git a/problems/qita/say_feel.md b/problems/qita/say_feel.md new file mode 100755 index 0000000000..00df8c0bf2 --- /dev/null +++ b/problems/qita/say_feel.md @@ -0,0 +1,14 @@ +恭喜你,已经把代码随想录通关了,欢迎在[卡码笔记](https://notes.kamacoder.com/question/102144)记录一下自己的收获,写一篇小作文。 + +不过一刷代码随想录,理解的一定是不到位的,建议二刷之后,对各个经典类型的题目就有自己的想法了。 + +大家可以在自己的博客写一篇 代码随想录一刷总结,记录这阶段性进步的一刻。 + +如果感觉代码随想录对你确实有帮助,不用买书,欢迎去[豆瓣](https://book.douban.com/subject/35680544/)给一个好评就好,代码随想录在豆瓣上被人恶意抹黑,希望录友们可以去说一说自己刷代码随想录的真实感受,感谢录友们的支持。 + +希望大家都能梦想成真,有好的前程,加油💪 + + + + + diff --git a/problems/qita/server.md b/problems/qita/server.md index 72476f5754..890cf8bcd5 100644 --- a/problems/qita/server.md +++ b/problems/qita/server.md @@ -51,7 +51,7 @@ 操作方式这样,我把命令包 包装成一个shell命令,想传那个文件,直接 uploadtomyserver,然后就返回可以下载的链接,这个文件也同时传到了我的服务器上。 -![](https://file.kamacoder.com/pics/20211126165643.png) +![](https://file1.kamacoder.com/i/algo/20211126165643.png) 我也把我的项目代码放在了github上: @@ -93,11 +93,11 @@ https://github.com/youngyangyang04/fileHttpServer 就是这样一个非常普通的查询页面。 -![](https://file.kamacoder.com/pics/20211126160200.png) +![](https://file1.kamacoder.com/i/algo/20211126160200.png) 查询通过之后,就会展现返现群二维码。 -![](https://file.kamacoder.com/pics/20211127160558.png) +![](https://file1.kamacoder.com/i/algo/20211127160558.png) 但要部署在服务器上,因为没有公网IP,别人用不了你的服务。 diff --git a/problems/qita/shejimoshi.md b/problems/qita/shejimoshi.md index 07d5540a25..959a3fa90a 100644 --- a/problems/qita/shejimoshi.md +++ b/problems/qita/shejimoshi.md @@ -7,11 +7,11 @@ 所以卡码网 针对 23种设计,**推出了 23道编程题目,来帮助大家练习设计模式**。 -
+
这里的23到编程题目对应了 23种这几模式。 例如第一题,小明的购物车,就是单例模式: -
+
区别于网上其他教程,本教程的特点是: @@ -40,18 +40,18 @@ 同时还给全部整理到PDF上,这份PDF,我们写的很用心了,来个大家截个图: -
+
-
+
-
+
-
+
关于设计模式的题目,大家现在就可以去 卡码网(kamacoder)去做了。 关于这23道题目对应 设计模式精讲 PDF,也免费分享给录友们,大家可以加我的企业微信获取: -
+
已经有我企业微信的录友,直接发:设计模式,这四个字就好,我会直接发你。 diff --git a/problems/qita/tulunfabu.md b/problems/qita/tulunfabu.md index b45b790d81..8987709564 100644 --- a/problems/qita/tulunfabu.md +++ b/problems/qita/tulunfabu.md @@ -8,7 +8,7 @@ 我知道录友们在等图论等太久了,其实我比大家都着急。 -![大家一直都在催](https://file.kamacoder.com/pics/20240613105618.png) +![大家一直都在催](https://file1.kamacoder.com/i/algo/20240613105618.png) 图论完整版目前已经开放在代码随想录网站:programmercarl.com @@ -20,7 +20,7 @@ * 拓扑排序 * 最短路算法 -![](https://file.kamacoder.com/pics/20240613104436.png) +![](https://file1.kamacoder.com/i/algo/20240613104436.png) **耗时一年之久,代码随想录图论 终于面世了**! @@ -32,21 +32,21 @@ 随便截一些图,大家感受一下: -![](https://file.kamacoder.com/pics/20240613104703.png) +![](https://file1.kamacoder.com/i/algo/20240613104703.png) -![](https://file.kamacoder.com/pics/20240613104824.png) +![](https://file1.kamacoder.com/i/algo/20240613104824.png) -![](https://file.kamacoder.com/pics/20240613104852.png) +![](https://file1.kamacoder.com/i/algo/20240613104852.png) -![](https://file.kamacoder.com/pics/20240613104926.png) +![](https://file1.kamacoder.com/i/algo/20240613104926.png) -![](https://file.kamacoder.com/pics/20240613105007.png) +![](https://file1.kamacoder.com/i/algo/20240613105007.png) -![](https://file.kamacoder.com/pics/20240613105030.png) +![](https://file1.kamacoder.com/i/algo/20240613105030.png) -![](https://file.kamacoder.com/pics/20240613105106.png) +![](https://file1.kamacoder.com/i/algo/20240613105106.png) -![](https://file.kamacoder.com/pics/20240613105143.png) +![](https://file1.kamacoder.com/i/algo/20240613105143.png) 具体内容,大家可以去代码随想录网站(programmercarl.com)去看看,非常精彩! @@ -203,19 +203,19 @@ cout << result[result.size() - 1]; 当大家通过 代码随想录 提升了编程与算法能力,考上研或者找到好工作的时候,于我来说已经是很幸福的事情: -![对笔试帮助大](https://file.kamacoder.com/pics/20230914172536.png) +![对笔试帮助大](https://file1.kamacoder.com/i/algo/20230914172536.png) -![华为od将近满分](https://file.kamacoder.com/pics/20230914172607.png) +![华为od将近满分](https://file1.kamacoder.com/i/algo/20230914172607.png) -![研究生复试](https://file.kamacoder.com/pics/20240621103130.png) +![研究生复试](https://file1.kamacoder.com/i/algo/20240621103130.png) -![红包感谢代码随想录366](https://file.kamacoder.com/pics/20231123151310.png) +![红包感谢代码随想录366](https://file1.kamacoder.com/i/algo/20231123151310.png) -![上岸亚马逊](https://file.kamacoder.com/pics/20240206174151.png) +![上岸亚马逊](https://file1.kamacoder.com/i/algo/20240206174151.png) -![](https://file.kamacoder.com/pics/20220718094112.png) +![](https://file1.kamacoder.com/i/algo/20220718094112.png) -![](https://file.kamacoder.com/pics/20220718094332.png) +![](https://file1.kamacoder.com/i/algo/20220718094332.png) 至此**图论内容 已完全免费开放在代码随想录网站(programmercarl.com),造福广大学习编程的录友们**! diff --git a/problems/qita/tulunshuoming.md b/problems/qita/tulunshuoming.md new file mode 100755 index 0000000000..9d6e761ca8 --- /dev/null +++ b/problems/qita/tulunshuoming.md @@ -0,0 +1,44 @@ + +# 图论模块说明 + + +非常多录友在催更图论,同时大家也反馈面试中深搜广搜也最近常考的类型。 + +其实在代码随想录中的二叉树和回溯算法章节中已经讲过深搜和广搜,二叉树的遍历就是深搜和广搜在二叉树结构上的应用, 而回溯算法本身就是深搜,只不过利用其回溯的过程。 + +那么在图论中,深搜和广搜就是在图上的遍历,图的存储方式一般是 邻接表和邻接矩阵。 + +我已经在更新图论ing,不过还没有跟更新完,**之前计划是把更新完的部分先分享给[训练营](./xunlianying.html)和 [知识星球](./kstar.md) 录友,等全部更新完之后在完整的分享到网站上**。 + +不过其他录友们也很着急,我也算更新了不少了,就先分享出来给大家吧。 + +**我一直坚持给大家打造最硬核的算法教程而且是免费的!这一点一直都不会变!**。 + +(**注意图论章节还没有更新完,还有更精彩的内容在路上**) + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/problems/qita/update.md b/problems/qita/update.md new file mode 100755 index 0000000000..c562fd4b3c --- /dev/null +++ b/problems/qita/update.md @@ -0,0 +1,56 @@ + +## 2021年 8月11日 + +[代码随想录网站正式上线](https://mp.weixin.qq.com/s/-6rd_g7LrVD1fuKBYk2tXQ) + +## 2021年 10月19日 + +更新Java,Python,JS,Go版本题解 + +## 2022年 1月17日 + +添加评论功能和阅读量统计。 + +为了方便大家阅读,使用无需登录的评论插件 valine。 + +但由于本站访问量太大,leancloud的api调用超过3w次,就只能用付费版本了,本站使用2个小时之后就超过了3w次条用,而付费版本一年要上万块。 + +免费的网站实在承担不起,所以仅在部分页面添加的评论区。 + +例如各个专题中的理论基础和本章总结,都添加的评论区。 + +## 2022年 2月22日 + +升级内存和带宽以应对更大的访问量 + +## 2022年 5月12日 + +更新[星球生活](https://programmercarl.com/other/)专栏,题解支持C、TypeScript 语言版本 + +## 2022年 5月19日 + +补充[额外题目](https://programmercarl.com/other/ewaishuoming.html) + +## 2022年 6月10日 + +添加边框,可以方便调节黑暗模式,开始加入Scala 和 C# 语言版本。 + +## 2023年 5月8日 + +题解都配上了《代码随想录》算法公开课视频讲解 + +## 2023年 9月11日 + +更新部分图论内容,深搜广搜和并查集 + +## 2024年 4月7日 + +由于访问量过大,网站访问速度慢一直被很多录友诟病,特别是海外录友访问更卡。 + +这次网站全部上CDN,全球加速,方便全球录友学习。 + +同时添加github评论区,录友可以在每篇文章下打卡了! + +## 更多精彩,敬请期待 + + diff --git "a/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" "b/problems/\344\270\272\344\272\206\347\273\235\346\235\200\347\274\226\350\276\221\350\267\235\347\246\273\357\274\214\345\215\241\345\260\224\345\201\232\344\272\206\344\270\211\346\255\245\351\223\272\345\236\253.md" old mode 100644 new mode 100755 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" "b/problems/\344\272\214\345\217\211\346\240\221\344\270\255\351\200\222\345\275\222\345\270\246\347\235\200\345\233\236\346\272\257.md" old mode 100644 new mode 100755 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index a67cf5db9d..7d25d81876 --- "a/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\346\200\273\347\273\223\347\257\207.md" @@ -147,7 +147,7 @@ 二叉树专题汇聚为一张图: -![](https://file.kamacoder.com/pics/20211030125421.png) +![](https://file1.kamacoder.com/i/algo/20211030125421.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[青](https://wx.zsxq.com/dweb2/index/footprint/185251215558842),所画,总结的非常好,分享给大家。 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 1fbbc9d934..a68f93a901 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -15,7 +15,7 @@ 题目分类大纲如下: -二叉树大纲 +二叉树大纲 说到二叉树,大家对于二叉树其实都很熟悉了,本文呢我也不想教科书式的把二叉树的基础内容再啰嗦一遍,所以以下我讲的都是一些比较重点的内容。 @@ -31,7 +31,7 @@ 如图所示: - + 这棵二叉树为满二叉树,也可以说深度为k,有2^k-1个节点的二叉树。 @@ -46,7 +46,7 @@ 我来举一个典型的例子如题: - + 相信不少同学最后一个二叉树是不是完全二叉树都中招了。 @@ -63,7 +63,7 @@ 下面这两棵树都是搜索树 - + ### 平衡二叉搜索树 @@ -72,7 +72,7 @@ 如图: - + 最后一棵 不是平衡二叉树,因为它的左右两个子树的高度差的绝对值超过了1。 @@ -91,13 +91,13 @@ 链式存储如图: - + 链式存储是大家很熟悉的一种方式,那么我们来看看如何顺序存储呢? 其实就是用数组来存储二叉树,顺序存储的方式如图: - + 用数组来存储二叉树如何遍历的呢? @@ -144,7 +144,7 @@ 大家可以对着如下图,看看自己理解的前后中序有没有问题。 - + 最后再说一说二叉树中深度优先和广度优先遍历实现方式,我们做二叉树相关题目,经常会使用递归的方式来实现深度优先遍历,也就是实现前中后序遍历,使用递归是比较方便的。 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" old mode 100644 new mode 100755 index d001e0f7a7..803b25ae80 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\347\273\237\344\270\200\350\277\255\344\273\243\346\263\225.md" @@ -67,7 +67,7 @@ public: 看代码有点抽象我们来看一下动画(中序遍历): -![中序遍历迭代(统一写法)](https://code-thinking.cdn.bcebos.com/gifs/%E4%B8%AD%E5%BA%8F%E9%81%8D%E5%8E%86%E8%BF%AD%E4%BB%A3%EF%BC%88%E7%BB%9F%E4%B8%80%E5%86%99%E6%B3%95%EF%BC%89.gif) +![中序遍历迭代(统一写法)](https://file1.kamacoder.com/i/algo/%E4%B8%AD%E5%BA%8F%E9%81%8D%E5%8E%86%E8%BF%AD%E4%BB%A3%EF%BC%88%E7%BB%9F%E4%B8%80%E5%86%99%E6%B3%95%EF%BC%89.gif) 动画中,result数组就是最终结果集。 diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" old mode 100644 new mode 100755 index e011612ca6..efa07d97d9 --- "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" +++ "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\350\277\255\344\273\243\351\201\215\345\216\206.md" @@ -38,7 +38,7 @@ 动画如下: -![二叉树前序遍历(迭代法)](https://code-thinking.cdn.bcebos.com/gifs/%E4%BA%8C%E5%8F%89%E6%A0%91%E5%89%8D%E5%BA%8F%E9%81%8D%E5%8E%86%EF%BC%88%E8%BF%AD%E4%BB%A3%E6%B3%95%EF%BC%89.gif) +![二叉树前序遍历(迭代法)](https://file1.kamacoder.com/i/algo/%E4%BA%8C%E5%8F%89%E6%A0%91%E5%89%8D%E5%BA%8F%E9%81%8D%E5%8E%86%EF%BC%88%E8%BF%AD%E4%BB%A3%E6%B3%95%EF%BC%89.gif) 不难写出如下代码: (**注意代码中空节点不入栈**) @@ -85,7 +85,7 @@ public: 动画如下: -![二叉树中序遍历(迭代法)](https://code-thinking.cdn.bcebos.com/gifs/%E4%BA%8C%E5%8F%89%E6%A0%91%E4%B8%AD%E5%BA%8F%E9%81%8D%E5%8E%86%EF%BC%88%E8%BF%AD%E4%BB%A3%E6%B3%95%EF%BC%89.gif) +![二叉树中序遍历(迭代法)](https://file1.kamacoder.com/i/algo/%E4%BA%8C%E5%8F%89%E6%A0%91%E4%B8%AD%E5%BA%8F%E9%81%8D%E5%8E%86%EF%BC%88%E8%BF%AD%E4%BB%A3%E6%B3%95%EF%BC%89.gif) **中序遍历,可以写出如下代码:** @@ -117,7 +117,7 @@ public: 再来看后序遍历,先序遍历是中左右,后序遍历是左右中,那么我们只需要调整一下先序遍历的代码顺序,就变成中右左的遍历顺序,然后在反转result数组,输出的结果顺序就是左右中了,如下图: -![前序到后序](https://file.kamacoder.com/pics/20200808200338924.png) +![前序到后序](https://file1.kamacoder.com/i/algo/20200808200338924.png) **所以后序遍历只需要前序遍历的代码稍作修改就可以了,代码如下:** diff --git "a/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" "b/problems/\344\272\214\345\217\211\346\240\221\347\232\204\351\200\222\345\275\222\351\201\215\345\216\206.md" old mode 100644 new mode 100755 diff --git "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" index f1ff3a5ffc..70643b7e49 100644 --- "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" +++ "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217.md" @@ -5,15 +5,15 @@ 平时大家在力扣上刷题,就是 核心代码模式,即给你一个函数,直接写函数实现,例如这样: -![](https://file.kamacoder.com/pics/20231109193631.png) +![](https://file1.kamacoder.com/i/algo/20231109193631.png) 而ACM模式,是程序头文件,main函数,数据的输入输出都要自己处理,例如这样: -![](https://file.kamacoder.com/pics/20231109193743.png) +![](https://file1.kamacoder.com/i/algo/20231109193743.png) 大家可以发现 右边代码框什么都没有,程序从头到尾都需要自己实现,本题如果写完代码是这样的: (细心的录友可以发现和力扣上刷题是不一样的) -![](https://file.kamacoder.com/pics/20231109193931.png) +![](https://file1.kamacoder.com/i/algo/20231109193931.png) **如果大家从一开始学习算法就一直在力扣上的话,突然切到ACM模式会非常不适应**。 @@ -21,15 +21,15 @@ 知识星球里也有很多录友,因为不熟悉ACM模式在面试的过程中吃了不少亏。 -
+
-
+
-
+
-
+
-
+
## 面试究竟怎么考? @@ -53,7 +53,7 @@ 你只要能把卡码网首页的25道题目 都刷了 ,就把所有的ACM输入输出方式都练习到位了,不会有任何盲区。 -![](https://file.kamacoder.com/pics/20231109195056.png) +![](https://file1.kamacoder.com/i/algo/20231109195056.png) 而且你不用担心,题目难度太大,直接给自己劝退,**卡码网的前25道题目都是我精心制作的,难度也是循序渐进的**,大家去刷一下就知道了。 diff --git "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" index 086e6e0ea0..2eeb7431bf 100644 --- "a/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" +++ "b/problems/\345\211\215\345\272\217/ACM\346\250\241\345\274\217\345\246\202\344\275\225\346\236\204\345\273\272\344\272\214\345\217\211\346\240\221.md" @@ -15,7 +15,7 @@ 其输入用例,就是用一个数组来表述 二叉树,如下: -![](https://file.kamacoder.com/pics/20210914222335.png) +![](https://file1.kamacoder.com/i/algo/20210914222335.png) 一直跟着公众号学算法的录友 应该知道,我在[二叉树:构造二叉树登场!](https://mp.weixin.qq.com/s/Dza-fqjTyGrsRw4PWNKdxA),已经讲过,**只有 中序与后序 和 中序和前序 可以确定一棵唯一的二叉树。 前序和后序是不能确定唯一的二叉树的**。 @@ -24,7 +24,7 @@ 很明显,是后台直接明确了构造规则。 再看一下 这个 输入序列 和 对应的二叉树。 -![](https://file.kamacoder.com/pics/20210914222335.png) +![](https://file1.kamacoder.com/i/algo/20210914222335.png) 从二叉树 推导到 序列,大家可以发现这就是层序遍历。 @@ -36,7 +36,7 @@ 顺序存储,就是用一个数组来存二叉树,其方式如图所示: -![](https://file.kamacoder.com/pics/20210914223147.png) +![](https://file1.kamacoder.com/i/algo/20210914223147.png) 那么此时大家是不是应该知道了,数组如何转化成 二叉树了。**如果父节点的数组下标是i,那么它的左孩子下标就是i * 2 + 1,右孩子下标就是 i * 2 + 2**。 @@ -80,7 +80,7 @@ TreeNode* construct_binary_tree(const vector& vec) { 这个函数最后返回的 指针就是 根节点的指针, 这就是 传入二叉树的格式了,也就是 力扣上的用例输入格式,如图: -![](https://file.kamacoder.com/pics/20210914224422.png) +![](https://file1.kamacoder.com/i/algo/20210914224422.png) 也有不少同学在做ACM模式的题目,就经常疑惑: @@ -176,7 +176,7 @@ int main() { 和 [538.把二叉搜索树转换为累加树](https://mp.weixin.qq.com/s/rlJUFGCnXsIMX0Lg-fRpIw) 中的输入是一样的 -![](https://file.kamacoder.com/pics/20210914222335.png) +![](https://file1.kamacoder.com/i/algo/20210914222335.png) 这里可能又有同学疑惑,你这不一样啊,题目是null,你为啥用-1。 @@ -184,11 +184,11 @@ int main() { 在来看,测试代码输出的效果: -![](https://file.kamacoder.com/pics/20210914230045.png) +![](https://file1.kamacoder.com/i/algo/20210914230045.png) 可以看出和 题目中输入用例 这个图 是一样一样的。 只不过题目中图没有把 空节点 画出来而已。 -![](https://file.kamacoder.com/pics/20210914230118.png) +![](https://file1.kamacoder.com/i/algo/20210914230118.png) 大家可以拿我的代码去测试一下,跑一跑。 @@ -205,7 +205,7 @@ int main() { **[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)**里有的录友已经开始三刷: -![](https://file.kamacoder.com/pics/20210727234031.png) +![](https://file1.kamacoder.com/i/algo/20210727234031.png) 只做过一遍,真的就是懂了一点皮毛, 第二遍刷才有真的对各个题目有较为深入的理解,也会明白 我为什么要这样安排刷题的顺序了。 @@ -419,4 +419,4 @@ func main() { ``` ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/BAT\347\272\247\345\210\253\346\212\200\346\234\257\351\235\242\350\257\225\346\265\201\347\250\213\345\222\214\346\263\250\346\204\217\344\272\213\351\241\271\351\203\275\345\234\250\350\277\231\351\207\214\344\272\206.md" "b/problems/\345\211\215\345\272\217/BAT\347\272\247\345\210\253\346\212\200\346\234\257\351\235\242\350\257\225\346\265\201\347\250\213\345\222\214\346\263\250\346\204\217\344\272\213\351\241\271\351\203\275\345\234\250\350\277\231\351\207\214\344\272\206.md" index 27940f1bd5..7d112a19c8 100644 --- "a/problems/\345\211\215\345\272\217/BAT\347\272\247\345\210\253\346\212\200\346\234\257\351\235\242\350\257\225\346\265\201\347\250\213\345\222\214\346\263\250\346\204\217\344\272\213\351\241\271\351\203\275\345\234\250\350\277\231\351\207\214\344\272\206.md" +++ "b/problems/\345\211\215\345\272\217/BAT\347\272\247\345\210\253\346\212\200\346\234\257\351\235\242\350\257\225\346\265\201\347\250\213\345\222\214\346\263\250\346\204\217\344\272\213\351\241\271\351\203\275\345\234\250\350\277\231\351\207\214\344\272\206.md" @@ -211,4 +211,4 @@ leetcode是专门针对算法练习的题库,leetcode现在也推出了中文 ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/gitserver.md" "b/problems/\345\211\215\345\272\217/gitserver.md" new file mode 100755 index 0000000000..caf93ec6ec --- /dev/null +++ "b/problems/\345\211\215\345\272\217/gitserver.md" @@ -0,0 +1,312 @@ + +# 一文手把手教你搭建Git私服 + +## 为什么要搭建Git私服 + +很多同学都问文章,文档,资料怎么备份啊,自己电脑和公司电脑怎么随时同步资料啊等等,这里呢我写一个搭建自己的git私服的详细教程 + +为什么要搭建一个Git私服呢,而不是用Github免费的私有仓库,有以下几点: +* Github 私有仓库真的慢,文件一旦多了,或者有图片文件,git pull 的时候半天拉不下来 +* 自己的文档难免有自己个人信息,放在github心里也是担心的 +* 想建几个库就建几个,想几个人合作开发都可以,不香么? + +**网上可以搜到很多git搭建,但是说的模棱两可**,而且有的直接是在本地搭建git服务,既然是备份,搭建在本地哪有备份的意义,一定要有一个远端服务器, 而且自己的电脑和公司的电脑还是同步自己的文章,文档和资料等等。 + + +适合人群: 想通过git私服来备份自己的文章,Markdown,并做版本管理的同学 +最后,写好每篇 Chat 是对我的责任,也是对你的尊重。谢谢大家~ + +正文如下: + +----------------------------- + +## 如何找到可以外网访问服务器 + +有的同学问了,自己的电脑就不能作为服务器么? + +这里要说一下,安装家庭带宽,运营商默认是不会给我们独立分配公网IP的 + +一般情况下是一片区域公用一个公网IP池,所以外网是不能访问到在家里我们使用的电脑的 + +除非我们自己去做映射,这其实非常麻烦而且公网IP池 是不断变化的 + +辛辛苦苦做了映射,运营商给IP一换,我们的努力就白扯了 + +那我们如何才能找到一个外网可以访问的服务器呢,此时云计算拯救了我们。 + +推荐大家选一家云厂商(阿里云,腾讯云,百度云都可以)在上面上买一台云服务器 + +* [阿里云活动期间服务器购买](https://www.aliyun.com/minisite/goods?taskCode=shareNew2205&recordId=3641992&userCode=roof0wob) +* [腾讯云活动期间服务器购买](https://curl.qcloud.com/EiaMXllu) + +云厂商经常做活动,如果从来没有买过云服务器的账号更便宜,低配一年一百块左右的样子,强烈推荐一起买个三年。 + +买云服务器的时候推荐直接安装centos系统。 + +这里要说一下,有了自己的云服务器之后 不仅仅可以用来做git私服 + +**同时还可以做网站,做程序后台,跑程序,做测试**(这样我们自己的电脑就不会因为自己各种搭建环境下载各种包而搞的的烂糟糟),等等等。 + +有自己云服务器和一个公网IP真的是一件非常非常幸福的事情,能体验到自己的服务随时可以部署上去提供给所有人使用的喜悦。 + +外网可以访问的服务器解决了,接下来就要部署git服务了 + +本文将采用centos系统来部署git私服 + +## 服务器端安装Git + +切换至root账户 + +``` +su root +``` + +看一下服务器有没有安装git,如果出现下面信息就说明是有git的 +``` +[root@instance-5fcyjde7 ~]# git +usage: git [--version] [--help] [-c name=value] + [--exec-path[=]] [--html-path] [--man-path] [--info-path] + [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] + [--git-dir=] [--work-tree=] [--namespace=] + [] + +The most commonly used git commands are: + add Add file contents to the index + bisect Find by binary search the change that introduced a bug + branch List, create, or delete branches + checkout Checkout a branch or paths to the working tree + clone Clone a repository into a new directory + commit Record changes to the repository + diff Show changes between commits, commit and working tree, etc + fetch Download objects and refs from another repository + grep Print lines matching a pattern + init Create an empty Git repository or reinitialize an existing one + log Show commit logs + merge Join two or more development histories together + mv Move or rename a file, a directory, or a symlink + pull Fetch from and merge with another repository or a local branch + push Update remote refs along with associated objects + rebase Forward-port local commits to the updated upstream head + reset Reset current HEAD to the specified state + rm Remove files from the working tree and from the index + show Show various types of objects + status Show the working tree status + tag Create, list, delete or verify a tag object signed with GPG + +'git help -a' and 'git help -g' lists available subcommands and some +concept guides. See 'git help ' or 'git help ' +to read about a specific subcommand or concept. +``` + +如果没有git,就安装一下,yum安装的版本默认是 `1.8.3.1` + +``` +yum install git +``` + +安装成功之后,看一下自己安装的版本 + +``` +git --version +``` + +## 服务器端设置Git账户 + +创建一个git的linux账户,这个账户只做git私服的操作,也是为了安全起见 + +如果不新创建一个linux账户,在自己的常用的linux账户下创建的话,哪天手抖 来一个`rm -rf *` 操作 数据可全没了 + +**这里linux git账户的密码设置的尽量复杂一些,我这里为了演示,就设置成为'gitpassword'** +``` +adduser git +passwd gitpassword +``` + +然后就要切换成git账户,进行后面的操作了 +``` +[root@instance-5fcyjde7 ~]# su - git +``` + +看一下自己所在的目录,是不是在git目录下面 + +``` +[git@instance-5fcyjde7 ~]$ pwd +/home/git +``` + +## 服务器端密钥管理 + +创建`.ssh` 目录,如果`.ssh` 已经存在了,可以忽略这一项 + +为啥用配置ssh公钥呢,同学们记不记得我使用github上传代码的时候也要把自己的公钥配置上传到github上 + +这也是方面每次操作git仓库的时候不用再去输入密码 + +``` +cd ~/ +mkdir .ssh +``` + +进入.ssh 文件下,创建一个 `authorized_keys` 文件,这个文件就是后面就是要放我们客户端的公钥 + +``` +cd ~/.ssh +touch authorized_keys +``` + +别忘了`authorized_keys`给设置权限,很多同学发现自己不能免密登陆,都是因为忘记了给`authorized_keys` 设置权限 + +``` +chmod 700 /home/git/.ssh +chmod 600 /home/git/.ssh/authorized_keys +``` + +接下来我们要把客户端的公钥放在git服务器上,我们在回到客户端,创建一个公钥 + +在我们自己的电脑上,有公钥和私钥 两个文件分别是:`id_rsa` 和 `id_rsa.pub` + +如果是`windows`系统公钥私钥的目录在`C:\Users\用户名\.ssh` 下 + +如果是mac 或者 linux, 公钥和私钥的目录这里 `cd ~/.ssh/`, 如果发现自己的电脑上没有公钥私钥,那就自己创建一个 + +创建密钥的命令 + +``` +ssh-keygen -t rsa +``` + +创建密钥的过程中,一路点击回车就可以了。不需要填任何东西 + +把公钥拷贝到git服务器上,将我们刚刚生成的`id_rsa.pub`,拷贝到git服务器的`/home/git/.ssh/`目录 + +在git服务器上,将公钥添加到`authorized_keys` 文件中 + +``` +cd /home/git/.ssh/ +cat id_rsa.pub >> authorized_keys +``` + +如何看我们配置的密钥是否成功呢, 在客户端直接登录git服务器,看看是否是免密登陆 +``` +ssh git@git服务器ip +``` + +例如: + +``` +ssh git@127.0.0.1 +``` + +如果可以免密登录,那就说明服务器端密钥配置成功了 + +## 服务器端部署Git 仓库 + +我们在登陆到git 服务器端,切换为成 git账户 + +如果是root账户切换成git账户 +``` +su - git +``` + +如果是其他账户切换为git账户 +``` +sudo su - git +``` + +进入git目录下 +``` +cd ~/git +``` + +创建我们的第一个Git私服的仓库,我们叫它为world仓库 + +那么首先创建一个文件夹名为: world.git ,然后进入这个目录 + +有同学问,为什么文件夹名字后面要放`.git`, 其实不这样命名也是可以的 + +但是细心的同学可能注意到,我们平时在github上 `git clone` 其他人的仓库的时候,仓库名字后面,都是加上`.git`的 + +例如下面这个例子,其实就是github对仓库名称的一个命名规则,所以我们也遵守github的命名规则。 + +``` +git clone https://github.com/youngyangyang04/NoSQLAttack.git +``` + +所以我们的操作是 +``` +[git@localhost git]# mkdir world.git +[git@localhost git]# cd world.git +``` + +初始化我们的`world`仓库 + +``` +git init --bare + +``` + +**如果我们想创建多个仓库,就在这里创建多个文件夹并初始化就可以了,和world仓库的操作过程是一样一样的** + +现在我们服务端的git仓库就部署完了,接下来就看看客户端,如何使用这个仓库呢 + +## 客户端连接远程仓库 + +我们在自己的电脑上创建一个文件夹 也叫做`world`吧 + +其实这里命名是随意的,但是我们为了和git服务端的仓库名称保持同步。 这样更直观我们操作的是哪一个仓库。 + +``` +mkdir world +cd world +``` + +进入world文件,并初始化操作 + +``` +cd world +git init +``` + +在world目录上创建一个测试文件,并且将其添加到git版本管理中 + +``` +touch test +git add test +git commit -m "add test file" +``` + +将次仓库和远端仓库同步 + +``` +git remote add origin git@git服务器端的ip:world.git +git push -u origin master +``` + +此时这个test测试文件就已经提交到我们的git远端私服上了 + +## Git私服安全问题 + +这里有两点安全问题 + +### linux git的密码不要泄露出去 + +否则,别人可以通过 ssh git@git服务器IP 来登陆到你的git私服服务器上 + +当然了,这里同学们如果买的是云厂商的云服务器的话 + +如果有人恶意想通过 尝试不同密码链接的方式来链接你的服务器,重试三次以上 + +这个客户端的IP就会被封掉,同时邮件通知我们可以IP来自哪里 + +所以大可放心 密码只要我们不泄露出去,基本上不会有人同时不断尝试密码的方式来登上我们的git私服服务器 + +### 私钥文件`id_rsa` 不要给别人 + +如果有人得到了这个私钥,就可以免密码登陆我们的git私服上了,我相信大家也不至于把自己的私钥主动给别人吧 + +## 总结 + +这里就是整个git私服搭建的全过程,安全问题我也给大家列举了出来,接下来好好享受自己的Git私服吧 + +**enjoy!** + diff --git "a/problems/\345\211\215\345\272\217/kvstore.md" "b/problems/\345\211\215\345\272\217/kvstore.md" new file mode 100755 index 0000000000..268fc018c7 --- /dev/null +++ "b/problems/\345\211\215\345\272\217/kvstore.md" @@ -0,0 +1,124 @@ + +# 手把手带你实现存储引擎 + + +之前在 [刷题攻略登上榜首](https://mp.weixin.qq.com/s/wZRTrA9Rbvgq1yEkSw4vfQ)这篇文章中说过,Carl不仅写了刷题攻略,还写了很多优秀的开源项目。 + +在星球里也有很多小伙伴问我关于一些,项目的选择,**相信如果是C++后台开发路线的话,基本都会去做WebServer 服务器**。 + +我在[知识星球](https://programmercarl.com/other/kstar.html)给小伙伴答疑,包括看了这么多简历,**发现WebServer这个项目是真的多,有点烂大街了**。 + +所以今天我把自己曾经开发的 KV存储引擎 给大家介绍一波,大家可以拿去当做自己的项目经验。 + +**相信只要是搞后端的同学应该都要熟悉非关系型数据库redis吧,那么应该知道redis的存储引擎是跳表实现的**。 + +现在很多云厂商提供的云数据库,其底层都是用了Facebook开源的rocksdb,而rocksdb的底层是Google开源的Levedb,**而Levedb的核心实现也是跳表**。 + +所以大家应该知道跳表的应用有多么的广泛了。 + +那么为什么这个项目非常合适大家用来做自己的项目经验呢? + +如果你是后端开发的话,你在简历上一定会写熟悉或者了解redis吧,那么可以进一步介绍一下自己的项目用跳表实现了redis核心引擎。 + +面试官一定会非常感兴趣的,然后你就可以和面试官侃侃而谈你是如何用跳表实现的这个KV存储引擎的。 + +**瞬间逼格就高了,有木有!** + +我在18年的时候,用跳表实现了一个轻量级KV存储引擎,代码也写的非常规范,熟悉我的录友应该知道,我的代码严格按照Google C++ style来的。 + +因为当时我是想把这个项目国际化的,注释和readme都是英文的,但最近我把这个项目又汉化回来了,方便大家理解。 + +给大家先随意看一段代码,我在注释中其实就已经在讲解跳表的运行原理了。代码使用了C++模板编程,这样接口支持任意类型的数据(包括自己自定义的类) + +![](https://file1.kamacoder.com/i/algo/20221104121454.png) + +项目地址:**https://github.com/youngyangyang04/Skiplist-CPP** + +这个项目中的代码质量是非常高的,如果无论是C++特性的运用,还是代码风格都是绝对拿得出手的! + +好了,牛逼吹完,然后给大家正式介绍一下这个项目 + +## KV存储引擎 + +本项目就是基于跳表实现的轻量级键值型存储引擎,使用C++实现。插入数据、删除数据、查询数据、数据展示、数据落盘、文件加载数据,以及数据库大小显示。 + +在随机写读情况下,该项目每秒可处理啊请求数(QPS): 24.39w,每秒可处理读请求数(QPS): 18.41w + +## 项目展示 + +![](https://file1.kamacoder.com/i/algo/20221104121509.png) + +文件功能: + +* main.cpp 包含skiplist.h使用跳表进行数据操作 +* skiplist.h 跳表核心实现 +* README.md 中文介绍 +* README-en.md 英文介绍 +* bin 生成可执行文件目录 +* makefile 编译脚本 +* store 数据落盘的文件存放在这个文件夹 +* stress_test_start.sh 压力测试脚本 +* LICENSE 使用协议 + + +## 提供接口 + +* insertElement(插入数据) +* deleteElement(删除数据) +* searchElement(查询数据) +* displayList(展示已存数据) +* dumpFile(数据落盘) +* loadFile(文件加载数据) +* size(返回数据规模) + +## 存储引擎数据表现 + +### 插入操作 + +跳表树高:18 + +采用随机插入数据测试: + + +|插入数据规模(万条) |耗时(秒) | +|---|---| +|10 |0.316763 | +|50 |1.86778 | +|100 |4.10648 | + + +每秒可处理写请求数(QPS): 24.39w + +### 取数据操作 + +|取数据规模(万条) |耗时(秒) | +|---|---| +|10|0.47148 |10| +|50|2.56373 |50| +|100|5.43204 |100| + +每秒可处理读请求数(QPS): 18.41w + +## 项目运行方式 + +``` +make // complie demo main.cpp +./bin/main // run +``` + +运行截图:(其中展示了插入数据,删除数据,展示数据等等功能) + +![](https://file1.kamacoder.com/i/algo/20221104121525.png) + +如果想自己写程序使用这个kv存储引擎,只需要在你的CPP文件中include skiplist.h 就可以了。 + +可以运行如下脚本测试kv存储引擎的性能(当然你可以根据自己的需求进行修改) + +``` +sh stress_test_start.sh +``` + +项目地址:**https://github.com/youngyangyang04/Skiplist-CPP** + +**大家白嫖的同时,别忘了给个star,fork,支持一波!** 录友如果最后拿到offer了,也别忘了和我道个喜哦。 + diff --git "a/problems/\345\211\215\345\272\217/server.md" "b/problems/\345\211\215\345\272\217/server.md" new file mode 100755 index 0000000000..890cf8bcd5 --- /dev/null +++ "b/problems/\345\211\215\345\272\217/server.md" @@ -0,0 +1,129 @@ + +# 一台服务器有什么用! + +* [阿里云活动期间服务器购买](https://www.aliyun.com/minisite/goods?taskCode=shareNew2205&recordId=3641992&userCode=roof0wob) +* [腾讯云活动期间服务器购买](https://curl.qcloud.com/EiaMXllu) + +但在组织这场活动的时候,了解到大家都有一个共同的问题: **这个服务器究竟有啥用??** + +这真是一个好问题,而且我一句两句还说不清楚,所以就专门发文来讲一讲。 + +同时我还录制的一期视频,我的视频号,大家可以关注一波。 + + +一说到服务器,可能很多人都说搞分布式,做计算,搞爬虫,做程序后台服务,多人合作等等。 + +其实这些普通人都用不上,我来说一说大家能用上的吧。 + +## 搭建git私服 + +大家平时工作的时候一定有一个自己的工作文件夹,学生的话就是自己的课件,考试,准备面试的资料等等。 + +已经工作的录友,会有一个文件夹放着自己重要的文档,Markdown,图片,简历等等。 + +这么重要的文件夹,而且我们每天都要更新,也担心哪天电脑丢了,或者坏了,突然这些都不见了。 + +所以我们想备份嘛。 + +还有就是我们经常个人电脑和工作电脑要同步一些私人资料,而不是用微信传来传去。 + +这些都是git私服的使用场景,而且很好用。 + +大家也知道 github,gitee也可以搞私人仓库 用来备份,同步文件,但自己的文档可能放着很多重要的信息,包括自己的各种密码,密钥之类的,放到上面未必安全。你就不怕哪些重大bug把你的信息都泄漏了么[机智] + +更关键的是,github 和 gitee都限速的。毕竟人家的功能定位并不是网盘。 + +项目里有大文件(几百M以上),例如pdf,ppt等等 其上传和下载速度会让你窒息。 + +**后面我会发文专门来讲一讲,如何大家git私服!** + +## 搞一个文件存储 + +这个可以用来生成文件的下载链接,也可以把本地文件传到服务器上。 + +相当于自己做一个对象存储,其实云厂商也有对象存储的产品。 + +不过我们自己也可以做一个,不够很多很同学应该都不知道对象存储怎么用吧,其实我们用服务器可以自己做一个类似的公司。 + +我现在就用自己用go写的一个工具,部署在服务器上。 用来和服务器传文件,或者生成一些文件的临时下载链接。 + +这些都是直接命令行操作的, + +操作方式这样,我把命令包 包装成一个shell命令,想传那个文件,直接 uploadtomyserver,然后就返回可以下载的链接,这个文件也同时传到了我的服务器上。 + +![](https://file1.kamacoder.com/i/algo/20211126165643.png) + +我也把我的项目代码放在了github上: + +https://github.com/youngyangyang04/fileHttpServer + +感兴趣的录友可以去学习一波,顺便给个star。 + + +## 网站 + +做网站,例如 大家知道用html 写几行代码,就可以生成一个网页,但怎么给别人展示呢? + +大家如果用自己的电脑做服务器,只能同一个路由器下的设备可以访问你的网站,可能这个设备出了这个屋子 都访问不了你的网站了。 + +因为你的IP不是公网IP。 + +如果有了一台云服务器,都是配公网IP,你的网站就可以让任何人访问了。 + +或者说 你提供的一个服务就可以让任何人使用。 + +例如第二个例子中,我们可以自己开发一个文件存储,这个服务,我只把把命令行给其他人,其他人都可以使用我的服务来生成链接,当然他们的文件也都传到了我的服务器上。 + +再说一个使用场景。 + +我之前在组织免费里服务器的活动的时候,阿里云给我一个excel,让面就是从我这里买服务器录友的名单,我直接把这个名单甩到群里,让大家自己检查,出现在名单里就可以找我返现,这样做是不是也可以。 + +这么做有几个很大的问题: +* 大家都要去下载excel,做对比,会有人改excel的内容然后就说是从你这里买的,我不可能挨个去比较excel有没有改动 +* excel有其他人的个人信息,这是不能暴漏的。 +* 如果每个人自己用excel查询,私信我返现,一个将近两千人找我返现,我微信根本处理不过来,这就变成体力活了。 + +那应该怎么做呢, + +我就简单写一个查询的页面,后端逻辑就是读一个execel表格,大家在查询页面输入自己的阿里云ID,如果在excel里,页面就会返回返现群的二维码,大家就可以自主扫码加群了。 + +这样,我最后就直接在返现群里 发等额红包就好了,是不是极大降低人力成本了 + +当然我是把 17个返现群的二维码都生成好了,按照一定的规则,展现给查询通过的录友。 + +就是这样一个非常普通的查询页面。 + +![](https://file1.kamacoder.com/i/algo/20211126160200.png) + +查询通过之后,就会展现返现群二维码。 + +![](https://file1.kamacoder.com/i/algo/20211127160558.png) + +但要部署在服务器上,因为没有公网IP,别人用不了你的服务。 + + +## 学习linux + +学习linux其实在自己的电脑上搞一台虚拟机,或者安装双系统也可以学习,不过这很考验你的电脑性能如何了。 + +如果你有一个服务器,那就是独立的一台电脑,你怎么霍霍就怎么霍霍,而且一年都不用关机的,可以一直跑你的任务,和你本地电脑也完全隔离。 + +更方便的是,你目前系统假如是CentOS,想做一个实验需要在Ubuntu上,如果是云服务器,更换系统就是在 后台点一下,一键重装,云厂商基本都是支持所有系统一件安装的。 + +我们平时自己玩linux经常是配各种环境,然后这个linux就被自己玩坏了(一般都是毫无节制使用root权限导致的),总之就是环境配不起来了,基本就要重装了。 + +那云服务器重装系统可太方便了。 + +还有就是加入你好不容易配好的环境,如果以后把这个环境玩坏了,你先回退这之前配好的环境而不是重装系统在重新配一遍吧。 + +那么可以用云服务器的镜像保存功能,就是你配好环境的那一刻就可以打一个镜像包,以后如果环境坏了,直接回退到上次镜像包的状态,这是不是就很香了。 + + +## 总结 + +其实云服务器还有很多其他用处,不过我就说一说大家普遍能用的上的。 + + +* [阿里云活动期间服务器购买](https://www.aliyun.com/minisite/goods?taskCode=shareNew2205&recordId=3641992&userCode=roof0wob) +* [腾讯云活动期间服务器购买](https://curl.qcloud.com/EiaMXllu) + diff --git "a/problems/\345\211\215\345\272\217/vim.md" "b/problems/\345\211\215\345\272\217/vim.md" index 13935b91c6..3f1daa53aa 100644 --- "a/problems/\345\211\215\345\272\217/vim.md" +++ "b/problems/\345\211\215\345\272\217/vim.md" @@ -62,7 +62,7 @@ IDE那么很吃内存,打开个IDE卡半天,用VIM就很轻便了,秒开 来感受一下PowerVim的使用体验,看起来很酷吧!注意这些操作都不用鼠标的,一波键盘控制流!所以我平时写代码是不碰鼠标的! -![](https://code-thinking.cdn.bcebos.com/gifs/vim_overview.gif) +![](https://file1.kamacoder.com/i/algo/vim_overview.gif) ## 安装 @@ -93,7 +93,7 @@ sh install.sh 当然 还有很多,我还详细写了PowerVim的快捷键,使用方法,插件,配置,等等,都在Github主页的README上。当时我的Github上写的都是英文README,这次为了方便大家阅读,我又翻译成中文README。 -![](https://file.kamacoder.com/pics/20211013102249.png) +![](https://file1.kamacoder.com/i/algo/20211013102249.png) Github地址:[https://github.com/youngyangyang04/PowerVim](https://github.com/youngyangyang04/PowerVim) diff --git "a/problems/\345\211\215\345\272\217/\344\270\212\346\265\267\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\344\270\212\346\265\267\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index 6309ef583e..0000000000 --- "a/problems/\345\211\215\345\272\217/\344\270\212\346\265\267\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,125 +0,0 @@ - -# 上海互联网公司总结 - -**个人总结难免有所疏忽,欢迎大家补充,公司好坏没有排名哈!** - -## 一线互联网 - -* 百度(上海) -* 阿里(上海) -* 腾讯(上海) -* 字节跳动(上海) -* 蚂蚁金服(上海) - -## 外企IT/互联网/硬件 - -* 互联网 - * Google(上海) - * 微软(上海) - * LeetCode/力扣(上海) - * unity(上海)游戏引擎 - * SAP(上海)主要产品是ERP - * PayPal(上海)在线支付鼻祖 - * eBay(上海)电子商务公司 -* 偏硬件 - * IBM(上海) - * Tesla(上海)特斯拉 - * Cisco(上海)思科 - * Intel(上海) - * AMD(上海)半导体产品领域 - * EMC(上海)易安信是美国信息存储资讯科技公司 - * NVIDIA(上海)英伟达是GPU(图形处理器)的发明者,人工智能计算的引领者 - -## 二线互联网 - -* 拼多多(总部) -* 饿了么(总部)阿里旗下。 -* 哈啰出行(总部)阿里旗下 -* 盒马(总部)阿里旗下 -* 哔哩哔哩(总部) -* 阅文集团(总部)腾讯旗下 -* 爱奇艺(上海)百度旗下 -* 携程(总部) -* 京东(上海) -* 网易(上海) -* 美团点评(上海) -* 唯品会(上海) - -## 硬件巨头 (有软件/互联网业务) - -华为(上海) - -## 三线互联网 - -* PPTV(总部) -* 微盟(总部)企业云端商业及营销解决方案提供商 -* 喜马拉雅(总部) -* 陆金所(总部)全球领先的线上财富管理平台 -* 口碑(上海)阿里旗下。 -* 三七互娱(上海) -* 趣头条(总部) -* 巨人网络(总部)游戏公司 -* 盛大网络(总部)游戏公司 -* UCloud(总部)云服务提供商 -* 达达集团(总部)本地即时零售与配送平台 -* 众安保险(总部)在线财产保险 -* 触宝(总部)触宝输入法等多款APP -* 平安系列 - -## 明星创业公司 - -* 小红书(总部) -* 叮咚买菜(总部) -* 蔚来汽车(总部) -* 七牛云(总部) -* 得物App(总部)品潮流尖货装备交易、球鞋潮品鉴别查验、互动潮流社区 -* 收钱吧(总部)开创了中国移动支付市场“一站式收款” -* 蜻蜓FM(总部)音频内容聚合平台 -* 流利说(总部)在线教育 -* Soul(总部)社交软件 -* 美味不用等(总部)智慧餐饮服务商 -* 微鲸科技(总部)专注于智能家居领域 -* 途虎养车(总部) -* 米哈游(总部)游戏公司 -* 莉莉丝游戏(总部)游戏公司 -* 樊登读书(总部)在线教育 - -## AI独角兽公司 - -* 依图科技(总部)和旷视,商汤对标,都是做安防视觉 -* 深兰科技(总部)致力于人工智能基础研究和应用开发 - -## 其他行业,涉及互联网 -* 花旗、摩根大通等一些列金融巨头 -* 百姓网 -* 找钢网 -* 安居客 -* 前程无忧 -* 东方财富 -* 三大电信运营商:中国移动、中国电信、中国联通 -* 沪江英语 -* 各大银行 - -通知:很多同学感觉自己基础还比较薄弱,想循序渐进的从头学一遍数据结构与算法,那你来对地方了。在公众号左下角「算法汇总」里已经按照各个系列难易程度排好顺序了,大家跟着文章顺序打卡学习就可以了,留言区有很多录友都在从头打卡!「算法汇总」会持续更新,大家快去看看吧! - -## 总结 - -大家如果看了[北京有这些互联网公司,你都知道么?](https://programmercarl.com/前序/北京互联网公司总结.html)和[深圳原来有这么多互联网公司,你都知道么?](https://programmercarl.com/前序/深圳互联网公司总结.html)就可以看出中国互联网氛围最浓的当然是北京,其次就是上海! - -很多人说深圳才是第二,上海没有产生BAT之类的企业。 - -**那么来看看上海在垂直领域上是如何独领风骚的,视频领域B站,电商领域拼多多小红书,生活周边有饿了么,大众点评(现与美团合并),互联网金融有蚂蚁金服和陆金所,出行领域有行业老大携程,而且BAT在上海都有部门还是很大的团队,再加上上海众多的外企,以及金融公司(有互联网业务)**。 - -此时就能感受出来,上海的互联网氛围要比深圳强很多! - -好了,希望这份list可以帮助到想在上海发展的录友们。 - -相对于北京和上海,深圳互联网公司断层很明显,腾讯一家独大,二线三线垂直行业的公司很少,所以说深圳腾讯的员工流动性相对是较低的,因为基本没得选。 - - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\344\272\222\350\201\224\347\275\221\345\244\247\345\216\202\347\240\224\345\217\221\346\265\201\347\250\213.md" "b/problems/\345\211\215\345\272\217/\344\272\222\350\201\224\347\275\221\345\244\247\345\216\202\347\240\224\345\217\221\346\265\201\347\250\213.md" deleted file mode 100644 index ed526897e5..0000000000 --- "a/problems/\345\211\215\345\272\217/\344\272\222\350\201\224\347\275\221\345\244\247\345\216\202\347\240\224\345\217\221\346\265\201\347\250\213.md" +++ /dev/null @@ -1,240 +0,0 @@ -# 揭秘互联网大厂研发流程 - -[B站:揭秘互联网大厂研发流程](https://www.bilibili.com/video/BV1KR4y1H7ST) - -很多录友会很好奇这么个事: - -* 大厂的研发流程应该是什么样的呢 -* 为什么会有那么多繁琐的流程呢 -* 每一步都有什么作用呢 - -这次给大家介绍一波大厂的研发流程,让大家明明白白。 - -其实对于几十人或者上百人一起开发一个项目的话,一个规范的研发流程是很重要的。 - -有的同学可能想,哪有这么多流程啊,就是写完代码,跑一下,没问题,然后就上线了。 - -其实在大厂里研发流程是很重要的。 - -**一个项目从开发到上线到后面的维护,从流程上就保证大家少出错,也方便后面人继续维护**。 - -那么接下来给大家介绍一下详细的流程。 - -## 1.需求文档 - -看需求文档,我们要根据需求文档来确定我们究竟要做什么。 - -一些同学可能感觉 为什么还要用一个需求文档呢,你就告诉我做啥我就做啥不就完事了? - -需求文档一方面是**倒逼产品经理去系统性的思考这个需求究竟有哪些功能**,用来满足哪些用户的需求。 - -另一方面是**保证我们在研发的时候,研发出来的功能是满足需求文档里所描述的**。 - -如果是口头对接的话,很有可能就是你做出来的东西,产品经理看完感觉:这和我说的需求不一样啊!!这和我想的不一样啊!! - -这样就是两个人相互“甩锅”,那这究竟是谁的锅呢。都没有一个证据,对吧。 - -所以说,有一个需求文档很重要。 - -而且每个阶段的需求文档相当于是把这个项目的整个迭代过程都记录下来了。 - -这样也方便后面的人,了解这个项目是如何迭代的。 - -## 2.这个需求包含了哪些功能 - -产品经理在需求文档里描述一个功能,那么我们在实现的时候,可能要改很多模块,或者说我们要增加一些模块。 - -就是我们从代码的角度上来讲,可能要增添很多功能才能满足 用户看起来好像微不足道的小功能。 - -例如点击登录,点击下单,后台都有很多模块协同运行的。 - -我们要把产品经理角度上的这个功能,拆解为我们代码角度上的具体应该开发的那些功能。 - -## 3.确定有哪些难点 - -这里可能有同学疑惑了,我确定这东西干嘛呢。 - -给大家举一个例子,给你一个需求文档。 - -你说你一周的时间就能把它开发完,那为什么是一周呢,为什么不是两天,为什么不是两周呢。 - -其实 和上面的领导汇报你的工作的时候 **都要把自己的工作进行量化**。 - -那么这个功能有哪些难点,我们要克服这个难点,所需要花费的时间,都要有一个大体的量化。 - -这样才能量化我们自己的工作,**领导其实不知道你的工作是简单 还是困难, 领导只在意最终结果**,所以你需要展现给领导你的工作是有难度的是有挑战的。 - -而且**这些也是我们年底用来晋升或者评职称的素材**。 - -如果这些东西你自己都不在乎的话,谁还会帮你在乎呢。 - -而且**确定了自己的工作难点,把这些难点都记录下来,对以后跳槽也很有帮助**。 - -面试官最喜欢问的问题,就是:**你做的项目中有哪些难点?以及你是如何克服的**。 - -所以这一步对自己个人成长来说也是很有重要的。 对于项目组来说也是记录下来,每一个迭代版本有哪些难点,这些难点团队是如何克服的。 - -这也是项目组往上一级去邀功的资料。 - - -## 4.画架构图 - -一般来说,大厂项目的架构都是比较复杂的,特别是后端架构。 - -如果添加一个模块连个文档都没有,连个图也没有,上来就添加的话,后面的人是很难维护的。 - -而且每个模块和每一个模块之间的依赖关系,如果没有画出一个架构图的话,直接看代码很容易直接就看懵了。 - -为什么你可以快速开发一个新的模块,也是因为之前团队有人把这个架构图画清楚了,你只需要看一眼这个架构图,就知道你的模块应该添加在哪里。 - -那么你去添加模块的时候,也应该把这个架构图相应的位置 完善一下。 - -同时呢,在画架构图的过程中,也增添了自己对整个系统架构的掌握程度。 - -这个图也会让你确定,你的模块在整个项目中扮演一个什么样的角色。 - -## 5.定协议 - -后台模块之间进行通讯需要协议,后台和前端通讯也需要协议。 - -所以只要有交互,就要确定协议的数据格式。 - -**定协议要考虑到兼容,要考虑易于维护**。 - -## 6.设计数据结构和算法 - -其实设计数据结构更多一些,因为我们要选择使用什么容器,什么格式来处理我们的数据。 - -至于算法的话,就很少我们亲自设计了。 - -什么快排,二叉树,动态规划,最短路啥的,在实际开发中,都不需要我们自己去写,**直接调包!** - -面试造火箭,工作拧螺丝 就体现在这里。 - -为什么会这样呢? 一个很简单的例子,互联网研发讲究其实就是要快,例如一个功能2天就要开发完,如果算法都要自己去写的话,等都写完了,花都谢了。 - -最关键的是,**你实现的算法 极大概率没有现成的算法接口安全性高**。 - -**开发中要学会才在巨人的肩膀上**。 - -## 7.预估一下容量 - -特别是后端开发,要估计出 我们自己模块大体需要多大磁盘,多大内存,多大带宽,多少核CPU。 - -这也是没有做过研发工作的同学经常忽略的,**因为大家好像默认 磁盘、内存、带宽、cpu是无穷的**。 - -其实我们在设计一个模块的时候,这些都要评估的,不能模块一上线,把机器直接打爆了。 - -例如 直接把带宽打满了,不仅影响自己的模块功能,还影响了机器上其他模块的运行。 - - -## 8.考虑部署 - -要考虑如果一台机器挂了(可能是硬件原因),那么我们的模块还能不能正常提供服务。 - -这就是考虑模块的容灾性,一般都是采用分布式,服务部署在三台机器上,一台如果挂了,还有其他两台提供服务。 - -还有就是要弹性可伸缩,即我们的模块可不可以直接 部署多台机器来提高承载能力。 - -如果用户量突然上来了,或者流量突然上来了,可以通过快速部署多台机器来抗住流量。 - -而不是模块只能在单机上跑,多部署几台就发生各种问题。 - -**这才能说明是有足够强的风险意识的**。 - -## 9.设计评审 - -前八的阶段其实都是设计阶段,那么你的设计需要让组里的同学一起来评审一下,看看有没有什么问题。 - -大家主要也是看看你的模块 会不会给其他模块或者整个系统带来什么问题 以及 设计的是否合理。 - - -## 10.写代码 - -终于到写代码的阶段了,其实到这时候,是最容易的。 - -**写代码就是体力活了,不是脑力活了**。 - -## 11.自测 - -写完代码,我们需要自测,自己的功能会不会有什么问题。 - -这里可能需要自己造一造数据,跑一跑 看看和预想的是不是一样的。 - -## 12.联调 - -自己的模块可能会涉及到其他模块之间的一个交互,或者和前端的一个交互。 - -所以需要其他同学配合一起来测试。 - -这里就有很多沟通工作了,因为其他同学可能手头有自己的活,那么就要协调一个时间来一起测试。 - -这一步也是很费时间的,**其费时关键是要等,要等其他同学有空和你联调或者是别人等你**,而且往往不是联调一次就能解决问题的。 - -所以 在评估开发时间的时候 也要考虑到联调的时间。 - -这也是大厂研发效率低的地方,但上百人开发的项目,**这种沟通上消耗也是在所难免的**。 - -## 13.交给测试 - -自己的代码,自己测 一般都测不出什么问题,需要交给测试同学来给你测一测。 - -这里如果测试同学测出问题,你就要判断确实有问题还是 测试方式不对,如果有问题就要修改,再提给测试,反反复复这么几轮,直到测试同学测试没问题了。 - -**这个过程也是累心的**。 - -## 14.code review - -代码合入主干之前,需要 项目组的同学一起来评审一下你的代码。 - -之前是评审设计,看设计上有没有什么缺失,这次是大家来看看你代码写的怎么样。 - -例如合入主干会不会有什么问题,代码兼容性做的好不好,接口设计的好不好,甚至字段,函数,变量名,命名合不合理。 - -都要经过大家的评审,如果有问题就还是要改。 - -如果没有问题一般 大家会给+2(就是通过的意思),这样就可以合入主干了。 - -## 15.合入主干 - -合入主干为什么会单独列出来呢。 - -其实合入主干是很重要的,经常是自己的代码没问题,但合入主干之后就有问题了。 - -一般就是合入主干的时候有冲突,例如你从主干拉出一个分支,另一个同学从主干拉出一个分支,而且两个分支修改了同一个模块,如果另一个同学提前合入主干,你再合入主干的时候就会有代码冲突。 - -在解决代码冲突的时候 就会修改别人的代码,这个过程很容易产生新的bug。 - - -**一般合入主干之后,测试同学还要重新跑一个全量测试,才能放心发布**。 - -如果跑全量测试没有问题的话,才会松一口气(懂的人都懂)。 - -## 16.发布 - -最后一步就是发布了。 - -发布其实就是把主干的代码更新到线上的服务器上。 - -一些还没有工作的同学,可能不太理解究竟什么是发布。 - -用大白话来讲,就是把 本地的代码或者某台机器的代码,编译成可执行文件,然后更新到 线上的服务器(一个独立的集群,专门处理线上的流量)并运行起来。 - -上线是最重要的一步了,也很容易出问题,因为一个大型项目,其上线的过程都非常复杂(要更新上百台机器的集群),而且**要考虑线上新版和旧版本的兼容问题**。 - -这也是为什么大厂项目都选择深夜上线,**因为深夜在线用户最少,如果出问题,影响的用户会比较少,可以快速修复**。 - -所以大家经常看到 某大厂程序员深夜上线发布版本之类的。 - -## 总结 - -好了,整整讲了十六个步骤!把大厂研发流程中 具体都有哪一步,为什么要这么做,都分析的很清楚了。 - -不过在大厂也不是所有部门都按照这个流程来的,每个部门都有自己玩法,各个部门也不太统一。 - -我这里是介绍的是已经比较规范的流程,**但流程越正规,研发效率就越低,想要提高效率,就是简化流程,简化流程,就会提高项目出错的概率**。 - -**所以这也是一个相互权衡的过程,每一个部门可能根据自己的业务特点,适当简化流程**。 - -好了,讲了这么多,希望对录友们有所启发。 - diff --git "a/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" "b/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" index 33891632b8..db54fcb3e7 100644 --- "a/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" +++ "b/problems/\345\211\215\345\272\217/\344\273\243\347\240\201\351\243\216\346\240\274.md" @@ -57,7 +57,7 @@ 我做了一下总结如图: -![编程风格](https://file.kamacoder.com/pics/20201119173039835.png) +![编程风格](https://file1.kamacoder.com/i/algo/20201119173039835.png) ### 水平留白(代码空格) @@ -134,4 +134,4 @@ Google规范是 大括号和 控制语句保持同一行的,我个人也很认 ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" "b/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" index 88fb129ee2..2be0bea5c1 100644 --- "a/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" +++ "b/problems/\345\211\215\345\272\217/\345\206\205\345\255\230\346\266\210\350\200\227.md" @@ -19,7 +19,7 @@ 如果我们写C++的程序,就要知道栈和堆的概念,程序运行时所需的内存空间分为 固定部分,和可变部分,如下: -![C++内存空间](https://file.kamacoder.com/pics/20210309165950660.png) +![C++内存空间](https://file1.kamacoder.com/i/algo/20210309165950660.png) 固定部分的内存消耗 是不会随着代码运行产生变化的, 可变部分则是会产生变化的 @@ -41,7 +41,7 @@ 想要算出自己程序会占用多少内存就一定要了解自己定义的数据类型的大小,如下: -![C++数据类型的大小](https://file.kamacoder.com/pics/20200804193045440.png) +![C++数据类型的大小](https://file1.kamacoder.com/i/algo/20200804193045440.png) 注意图中有两个不一样的地方,为什么64位的指针就占用了8个字节,而32位的指针占用4个字节呢? @@ -109,7 +109,7 @@ CPU读取内存不是一次读取单个字节,而是一块一块的来读取 第一种就是内存对齐的情况,如图: -![内存对齐](https://file.kamacoder.com/pics/20200804193307347.png) +![内存对齐](https://file1.kamacoder.com/i/algo/20200804193307347.png) 一字节的char占用了四个字节,空了三个字节的内存地址,int数据从地址4开始。 @@ -117,7 +117,7 @@ CPU读取内存不是一次读取单个字节,而是一块一块的来读取 第二种是没有内存对齐的情况如图: -![非内存对齐](https://file.kamacoder.com/pics/20200804193353926.png) +![非内存对齐](https://file1.kamacoder.com/i/algo/20200804193353926.png) char型的数据和int型的数据挨在一起,该int数据从地址1开始,那么CPU想要读这个数据的话来看看需要几步操作: @@ -145,4 +145,4 @@ char型的数据和int型的数据挨在一起,该int数据从地址1开始, ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\345\212\233\346\211\243\344\270\212\347\232\204\344\273\243\347\240\201\345\234\250\346\234\254\345\234\260\347\274\226\350\257\221\350\277\220\350\241\214.md" "b/problems/\345\211\215\345\272\217/\345\212\233\346\211\243\344\270\212\347\232\204\344\273\243\347\240\201\345\234\250\346\234\254\345\234\260\347\274\226\350\257\221\350\277\220\350\241\214.md" index 5b57d214db..5e91198948 100644 --- "a/problems/\345\211\215\345\272\217/\345\212\233\346\211\243\344\270\212\347\232\204\344\273\243\347\240\201\345\234\250\346\234\254\345\234\260\347\274\226\350\257\221\350\277\220\350\241\214.md" +++ "b/problems/\345\211\215\345\272\217/\345\212\233\346\211\243\344\270\212\347\232\204\344\273\243\347\240\201\345\234\250\346\234\254\345\234\260\347\274\226\350\257\221\350\277\220\350\241\214.md" @@ -61,4 +61,4 @@ int main() { ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\345\214\227\344\272\254\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\345\214\227\344\272\254\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index 7b42868e8f..0000000000 --- "a/problems/\345\211\215\345\272\217/\345\214\227\344\272\254\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,109 +0,0 @@ -# 北京互联网公司总结 - -

欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!

- - -**个人总结难免有所疏忽,欢迎大家补充,公司好坏没有排名哈!** - -如果要在北京找工作,这份list可以作为一个大纲,寻找自己合适的公司。 - -## 一线互联网 - -* 百度(总部) -* 阿里(北京) -* 腾讯(北京) -* 字节跳动(总部) - -## 外企 - -* 微软(北京)微软中国主要就是北京和苏州 -* Hulu(北京)美国的视频网站,听说福利待遇超级棒 -* Airbnb(北京)房屋租赁平台 -* Grab(北京)东南亚第一大出行 App -* 印象笔记(北京)evernote在中国的独立品牌 -* FreeWheel(北京)美国最大的视频广告管理和投放平台 -* amazon(北京)全球最大的电商平台 - -## 二线互联网 - -* 美团点评(总部) -* 京东(总部) -* 网易(北京) -* 滴滴出行(总部) -* 新浪(总部) -* 快手(总部) -* 搜狐(总部) -* 搜狗(总部) -* 360(总部) - -## 硬件巨头 (有软件/互联网业务) - -* 华为(北京) -* 联想(总部) -* 小米(总部)后序要搬到武汉,互联网业务也是小米重头 - -## 三线互联网 - -* 爱奇艺(总部) -* 去哪儿网(总部) -* 知乎(总部) -* 豆瓣(总部) -* 当当网(总部) -* 完美世界(总部)游戏公司 -* 昆仑万维(总部)游戏公司 -* 58同城(总部) -* 陌陌(总部) -* 金山软件(北京)包括金山办公软件 -* 用友网络科技(总部)企业服务ERP提供商 -* 映客直播(总部) -* 猎豹移动(总部) -* 一点资讯(总部) -* 国双(总部)企业级大数据和人工智能解决方案提供商 - -## 明星创业公司 - -可以发现北京一堆在线教育的公司,可能教育要紧盯了政策变化,所以都要在北京吧 - -* 好未来(总部)在线教育 -* 猿辅导(总部)在线教育 -* 跟谁学(总部)在线教育 -* 作业帮(总部)在线教育 -* VIPKID(总部)在线教育 -* 雪球(总部)股市资讯 -* 唱吧(总部) -* 每日优鲜(总部)让每个人随时随地享受食物的美好 -* 微店(总部) -* 罗辑思维(总部)得到APP -* 值得买科技(总部)让每一次消费产生幸福感 -* 拉勾网(总部)互联网招聘 - -## AI独角兽公司 - -* 商汤科技(总部)专注于计算机视觉和深度学习 -* 旷视科技(总部)人工智能产品和解决方案公司 -* 第四范式(总部)人工智能技术与服务提供商 -* 地平线机器人(总部)边缘人工智能芯片的全球领导者 -* 寒武纪(总部)全球智能芯片领域的先行者 - -## 互联网媒体 - -* 央视网 -* 搜房网 -* 易车网 -* 链家网 -* 自如网 -* 汽车之家 - - -北京的互联网氛围绝对是最好的(暂不讨论户口和房价问题),大家如果看了[深圳原来有这么多互联网公司,你都知道么?](https://programmercarl.com/前序/深圳互联网公司总结.html)这篇之后,**会发现北京互联网外企和二线互联网公司数量多的优势,在深圳的互联网公司断档比较严重,如果去不了为数不多的一线公司,可选择的余地就非常少了,而北京选择的余地就很多!** - -相对来说,深圳的硬件企业更多一些,因为珠三角制造业配套比较完善。而大多数互联网公司其实就是媒体公司,当然要靠近政治文化中心,这也是有原因的。 - -就酱,我也会陆续整理其他城市的互联网公司,希望对大家有所帮助。 - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\345\271\277\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\345\271\277\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index b8b1641b63..0000000000 --- "a/problems/\345\211\215\345\272\217/\345\271\277\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,77 +0,0 @@ -# 广州互联网公司总结 - -

欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!

- - -**个人总结难免有所疏忽,欢迎大家补充,公司好坏没有排名哈!** - -## 一线互联网 - -* 微信(总部) 有点难进! -* 字节跳动(广州) - -## 二线 -* 网易(总部)主要是游戏 - -## 三线 - -* 唯品会(总部) -* 欢聚时代(总部)旗下YY,虎牙,YY最近被浑水做空,不知百度还要不要收购了 -* 酷狗音乐(总部) -* UC浏览器(总部)现在隶属阿里创始人何小鹏现在搞小鹏汽车 -* 荔枝FM(总部)用户可以在手机上开设自己的电台和录制节目 -* 映客直播(总部)股票已经跌成渣了 -* 爱范儿(总部) -* 三七互娱(总部)游戏公司 -* 君海游戏(总部)游戏公司 -* 4399游戏(总部)游戏公司 -* 多益网络(总部)游戏公司 - -## 硬件巨头 (有软件/互联网业务) -* 小鹏汽车(总部)新能源汽车小霸王 - -## 创业公司 - -* 妈妈网(总部)母婴行业互联网公司 -* 云徙科技(总部)数字商业云服务提供商 -* Fordeal(总部)中东领先跨境电商平台 -* Mobvista(总部)移动数字营销 -* 久邦GOMO(总部)游戏 -* 深海游戏(总部)游戏 - -## 国企 - -* 中国电信广州研发(听说没有996) - - -## 总结 - -同在广东省,难免不了要和深圳对比,大家如果看了这篇:[深圳原来有这么多互联网公司,你都知道么?](https://programmercarl.com/前序/深圳互联网公司总结.html)就能感受到鲜明的对比了。 - -广州大厂高端岗位其实比较少,本土只有微信和网易,微信呢毕竟还是腾讯的分部,而网易被很多人认为是杭州企业,其实网易总部在广州。 - -广州是唯一一个一线城市没有自己本土互联网巨头的城市,所以网易选择在广州扎根还是很正确的,毕竟杭州是阿里的天下,广州也应该扶持一把本土的互联网公司。 - -虽然对于互联网从业人员来说,广州的岗位要比深圳少很多,**但是!!广州的房价整体要比深圳低30%左右,而且广州的教育,医疗,公共资源完全碾压深圳**。 - -教育方面:大学广州有两个985,四个211,深圳这方面就不用说了,大家懂得。 - -基础教育方面深圳的小学初中高中学校数量远远不够用,小孩上学竞争很激烈,我也是经常听同事们说,耳濡目染了。 - -而医疗上基本深圳看不了的病都要往广州跑,深圳的医院数量也不够用。 - -在生活节奏上,广州更慢一些,更有生活的气息,而深圳生存下去的气息更浓烈一些。 - -所以很多在深圳打拼多年的IT从业者选择去广州安家也是有原因的。 - -但也有很多从广州跑到深圳的,深圳发展的机会更多,而广州教育医疗更丰富,房价不高(相对深圳)。 - - - - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\346\210\220\351\203\275\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\346\210\220\351\203\275\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index f6a575f64d..0000000000 --- "a/problems/\345\211\215\345\272\217/\346\210\220\351\203\275\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,72 +0,0 @@ - -# 成都互联网公司总结 -

欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!

- - -**排名不分先后,个人总结难免有所疏漏,欢迎补充!** - -## 一线互联网 -* 腾讯(成都) 游戏,王者荣耀就在成都! -* 阿里(成都) -* 蚂蚁金服(成都) -* 字节跳动(成都) - -## 硬件巨头 (有软件/互联网业务) - -* 华为(成都) -* OPPO(成都) - -## 二线互联网 - -* 京东(成都) -* 美团(成都) -* 滴滴(成都) - -## 三线互联网 - -* 完美世界 (成都)游戏 -* 聚美优品 (成都) -* 陌陌 (成都) -* 爱奇艺(成都) - -## 外企互联网 - -* NAVER China (成都)搜索引擎公司,主要针对韩国市场 - -## 创业公司 - -* tap4fun(总部)游戏 -* 趣乐多(总部)游戏 -* 天上友嘉(总部)游戏 -* 三七互娱(成都)游戏 -* 咕咚(总部)智能运动 -* 百词斩(总部)在线教育 -* 晓多科技(总部)AI方向 -* 萌想科技(总部)实习僧 -* Camera360(总部)移动影像社区 -* 医联 (总部)医疗解决方案提供商 -* 小明太极 (总部)原创漫画文娱内容网站以及相关APP -* 小鸡叫叫(总部)致力于儿童教育的智慧解决方案 - - -## AI独角兽公司 - -* 科大讯飞(成都) -* 商汤(成都) - -## 总结 - -可以看出成都相对一线城市的互联网氛围确实差了很多。**但是!成都已经是在内陆城市中甚至二线城市中的佼佼者了!** - -从公司的情况上也可以看出:**成都互联网行业目前的名片是“游戏”**,腾讯、完美世界等大厂,还有无数小厂都在成都搞游戏,可能成都的天然属性就是娱乐,这里是游戏的沃土吧。 - -相信大家如果在一些招聘平台上去搜,其实很多公司都在成都,但都是把客服之类的工作安排在成都,而我在列举的时候尽量把研发相关在成都的公司列出来,这样对大家更有帮助。 - - - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" "b/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" index 045646ff7e..4252fc8779 100644 --- "a/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" +++ "b/problems/\345\211\215\345\272\217/\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" @@ -38,7 +38,7 @@ 同样的同理再看一下快速排序,都知道快速排序是O(nlogn),但是当数据已经有序情况下,快速排序的时间复杂度是O(n^2) 的,**所以严格从大O的定义来讲,快速排序的时间复杂度应该是O(n^2)**。 **但是我们依然说快速排序是O(nlogn)的时间复杂度,这个就是业内的一个默认规定,这里说的O代表的就是一般情况,而不是严格的上界**。如图所示: -![时间复杂度4,一般情况下的时间复杂度](https://file.kamacoder.com/pics/20200728185745611-20230310123844306.png) +![时间复杂度4,一般情况下的时间复杂度](https://file1.kamacoder.com/i/algo/20200728185745611-20230310123844306.png) 我们主要关心的还是一般情况下的数据形式。 @@ -49,7 +49,7 @@ 如下图中可以看出不同算法的时间复杂度在不同数据输入规模下的差异。 -![时间复杂度,不同数据规模的差异](https://file.kamacoder.com/pics/20200728191447384-20230310124015324.png) +![时间复杂度,不同数据规模的差异](https://file1.kamacoder.com/i/algo/20200728191447384-20230310124015324.png) 在决定使用哪些算法的时候,不是时间复杂越低的越好(因为简化后的时间复杂度忽略了常数项等等),要考虑数据规模,如果数据规模很小甚至可以用O(n^2)的算法比O(n)的更合适(在有常数项的时候)。 @@ -115,7 +115,7 @@ O(2 × n^2 + 10 × n + 1000) < O(3 × n^2),所以说最后省略掉常数项 为什么可以这么做呢?如下图所示: -![时间复杂度1.png](https://file.kamacoder.com/pics/20200728191447349-20230310124032001.png) +![时间复杂度1.png](https://file1.kamacoder.com/i/algo/20200728191447349-20230310124032001.png) 假如有两个算法的时间复杂度,分别是log以2为底n的对数和log以10为底n的对数,那么这里如果还记得高中数学的话,应该不难理解`以2为底n的对数 = 以2为底10的对数 * 以10为底n的对数`。 @@ -164,4 +164,4 @@ O(2 × n^2 + 10 × n + 1000) < O(3 × n^2),所以说最后省略掉常数项 ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\346\235\255\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\346\235\255\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index 6154cfe50f..0000000000 --- "a/problems/\345\211\215\345\272\217/\346\235\255\345\267\236\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,83 +0,0 @@ -# 杭州互联网公司总结 - -

欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!

- - -**个人总结难免有所疏忽,欢迎大家补充,公司好坏没有排名哈!** - -## 一线互联网 - -* 阿里巴巴(总部) -* 蚂蚁金服(总部)阿里旗下 -* 阿里云(总部)阿里旗下 -* 网易(杭州) 网易云音乐 -* 字节跳动(杭州)抖音分部 - -## 外企 - -* ZOOM (杭州研发中心)全球知名云视频会议服务提供商 -* infosys(杭州)印度公司,据说工资相对不高 -* 思科(杭州) - -## 二线互联网 - -* 滴滴(杭州) -* 快手(杭州) - -## 硬件巨头 (有软件/互联网业务) - -* 海康威视(总部)安防三巨头 -* 浙江大华(总部)安防三巨头 -* 杭州宇视(总部) 安防三巨头 -* 萤石 -* 华为(杭州) -* vivo(杭州) -* oppo(杭州) -* 魅族(杭州) - -## 三线互联网 - -* 蘑菇街(总部)女性消费者的电子商务网站 -* 有赞(总部)帮助商家进行网上开店、社交营销 -* 菜鸟网络(杭州) -* 花瓣网(总部)图片素材领导者 -* 兑吧(总部)用户运营服务平台 -* 同花顺(总部)网上股票证券交易分析软件 -* 51信用卡(总部)信用卡管理 -* 虾米(总部)已被阿里收购 -* 曹操出行(总部) -* 口碑网 (总部) - -## AI独角兽公司 - -* 旷视科技(杭州) -* 商汤(杭州) - -## 创业公司 - -* e签宝(总部)做电子签名 -* 婚礼纪(总部)好多结婚的朋友都用 -* 大搜车(总部)中国领先的汽车交易服务供应商 -* 二更(总部)自媒体 -* 丁香园(总部) - -## 总结 - -杭州距离上海非常近,难免不了和上海做对比,上海是金融之都,如果看了[上海有这些互联网公司,你都知道么?](https://programmercarl.com/前序/上海互联网公司总结.html)就会发现上海互联网也是仅次于北京的。 - -而杭州是阿里的大本营,到处都有阿里的影子,虽然有网易在,但是也基本是盖过去了,很多中小公司也都是阿里某某高管出来创业的。 - -杭州的阿里带动了杭州的电子商务领域热度非常高,如果你想做电商想做直播带货想做互联网营销,杭州都是圣地! - -如果要是写代码的话,每年各种节日促销,加班996应该是常态,电商公司基本都是这样,当然如果赶上一个好领导的话,回报也是很丰厚的。 - -「代码随想录」一直都是干活满满,值得介绍给每一位学习算法的同学! - - - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\346\267\261\345\234\263\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" "b/problems/\345\211\215\345\272\217/\346\267\261\345\234\263\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" deleted file mode 100644 index 52a8448b51..0000000000 --- "a/problems/\345\211\215\345\272\217/\346\267\261\345\234\263\344\272\222\350\201\224\347\275\221\345\205\254\345\217\270\346\200\273\347\273\223.md" +++ /dev/null @@ -1,79 +0,0 @@ - -# 深圳互联网公司总结 - -

欢迎大家参与本项目,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!

- -**个人总结难免有所疏忽,欢迎大家补充,公司好坏没有排名哈!** - -## 一线互联网 - -* 腾讯(总部深圳) -* 百度(深圳) -* 阿里(深圳) -* 字节跳动(深圳) - -## 硬件巨头 (有软件/互联网业务) - -* 华为(总部深圳) -* 中兴(总部深圳) -* 海能达(总部深圳) -* oppo(总部深圳) -* vivo(总部深圳) -* 深信服(总部深圳) -* 大疆(总部深圳,无人机巨头) -* 一加手机(总部深圳) -* 柔宇科技(最近口碑急转直下) - -## 二线大厂 - -* 快手(深圳) -* 京东(深圳) -* 顺丰(总部深圳) - -## 三线大厂 - -* 富途证券(2020年成功赴美上市,主要经营港股美股) -* 微众银行(总部深圳) -* 招银科技(总部深圳) -* 平安系列(平安科技、平安寿险、平安产险、平安金融、平安好医生等) -* Shopee(21年有裁员风波) -* 有赞(深圳) -* 迅雷(总部深圳) -* 金蝶(总部深圳) -* 随手记(总部深圳) - -## AI独角兽公司 - -* 商汤科技(人工智能领域的独角兽) -* 追一科技(一家企业级智能服务AI公司) -* 超多维科技 (计算机视觉、裸眼3D) -* 优必选科技 (智能机器人、人脸识别) - -## 明星创业公司 - -* 丰巢科技(让生活更简单) -* 人人都是产品经理(全球领先的产品经理和运营人 学习、交流、分享平台) -* 大丰收(综合农业互联网服务平台) -* 小鹅通(专注新教育的技术服务商) -* 货拉拉(拉货就找货拉拉) -* 编程猫(少儿编程教育头部企业) -* HelloTalk(全球最大的语言学习社交社区) -* 大宇无限( 拥有SnapTube, Lark Player 等多款广受海外新兴市场用户欢迎的产品) -* 知识星球(深圳大成天下公司出品) -* XMind(隶属深圳市爱思软件技术有限公司,思维导图软件) -* 小赢科技(以技术重塑人类的金融体验) - -## 其他行业(有软件/互联网业务) - -* 三大电信运营商:中国移动、中国电信、中国联通 -* 房产企业:恒大(暴雷)、万科 -* 中信深圳 -* 广发证券,深交所 -* 珍爱网(珍爱网是国内知名的婚恋服务网站之一) - - - - - ------------------------ -
diff --git "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\345\206\231\346\226\207\346\241\243\345\267\245\345\205\267.md" "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\345\206\231\346\226\207\346\241\243\345\267\245\345\205\267.md" index a2f6ee3b5f..c991be1542 100644 --- "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\345\206\231\346\226\207\346\241\243\345\267\245\345\205\267.md" +++ "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\345\206\231\346\226\207\346\241\243\345\267\245\345\205\267.md" @@ -130,4 +130,4 @@ Markdown支持部分html,例如这样 ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" index 1bdcccd586..762b55f400 100644 --- "a/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" +++ "b/problems/\345\211\215\345\272\217/\347\250\213\345\272\217\345\221\230\347\256\200\345\216\206.md" @@ -103,13 +103,13 @@ Carl校招社招都拿过大厂的offer,同时也看过很多应聘者的简 最后福利,把我的简历模板贡献出来!如下图所示。 -![简历模板](https://file.kamacoder.com/pics/20200803175538158.png) +![简历模板](https://file1.kamacoder.com/i/algo/20200803175538158.png) 这里是简历模板中Markdown的代码:[https://github.com/youngyangyang04/Markdown-Resume-Template](https://github.com/youngyangyang04/Markdown-Resume-Template) ,可以fork到自己Github仓库上,按照这个模板来修改自己的简历。 **Word版本的简历,添加如下企业微信,通过之后就会发你word版本**。 -
+
如果已经有我的企业微信,直接回复:简历模板,就可以了。 @@ -119,4 +119,4 @@ Carl校招社招都拿过大厂的offer,同时也看过很多应聘者的简 ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246.md" "b/problems/\345\211\215\345\272\217/\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246.md" index b669049293..da2caa24b6 100644 --- "a/problems/\345\211\215\345\272\217/\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246.md" +++ "b/problems/\345\211\215\345\272\217/\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246.md" @@ -65,4 +65,4 @@ for (int i = 0; i < n; i++) { ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" "b/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" index ca1a422c0b..5603412717 100644 --- "a/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" +++ "b/problems/\345\211\215\345\272\217/\347\256\227\346\263\225\350\266\205\346\227\266.md" @@ -8,7 +8,7 @@ ## 超时是怎么回事 -![程序超时](https://file.kamacoder.com/pics/20200729112716117-20230310124308704.png) +![程序超时](https://file1.kamacoder.com/i/algo/20200729112716117-20230310124308704.png) 大家在leetcode上练习算法的时候应该都遇到过一种错误是“超时”。 @@ -124,11 +124,11 @@ int main() { 来看一下运行的效果,如下图: -![程序超时2](https://file.kamacoder.com/pics/20200729200018460-20230310124315093.png) +![程序超时2](https://file1.kamacoder.com/i/algo/20200729200018460-20230310124315093.png) O(n)的算法,1s内大概计算机可以运行 5 * (10^8)次计算,可以推测一下 $O(n^2)$ 的算法应该1s可以处理的数量级的规模是 5 * (10^8)开根号,实验数据如下。 -![程序超时3](https://file.kamacoder.com/pics/2020072919590970-20230310124318532.png) +![程序超时3](https://file1.kamacoder.com/i/algo/2020072919590970-20230310124318532.png) O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚刚的推测。 @@ -136,7 +136,7 @@ O(n^2)的算法,1s内大概计算机可以运行 22500次计算,验证了刚 理论上应该是比 $O(n)$ 少一个数量级,因为 $\log n$ 的复杂度 其实是很快,看一下实验数据。 -![程序超时4](https://file.kamacoder.com/pics/20200729195729407-20230310124322232.png) +![程序超时4](https://file1.kamacoder.com/i/algo/20200729195729407-20230310124322232.png) $O(n\log n)$ 的算法,1s内大概计算机可以运行 2 * (10^7)次计算,符合预期。 @@ -144,7 +144,7 @@ $O(n\log n)$ 的算法,1s内大概计算机可以运行 2 * (10^7)次计算, **整体测试数据整理如下:** -![程序超时1](https://file.kamacoder.com/pics/20201208231559175-20230310124325152.png) +![程序超时1](https://file1.kamacoder.com/i/algo/20201208231559175-20230310124325152.png) 至于 $O(\log n)$ 和 $O(n^3)$ 等等这些时间复杂度在1s内可以处理的多大的数据规模,大家可以自己写一写代码去测一下了。 @@ -278,4 +278,4 @@ public class TimeComplexity { ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" index 035399ce0f..01c07a5c00 100644 --- "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" +++ "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" @@ -29,7 +29,7 @@ int fibonacci(int i) { 可以看出上面的代码每次递归都是O(1)的操作。再来看递归了多少次,这里将i为5作为输入的递归过程 抽象成一棵递归树,如图: -![递归空间复杂度分析](https://file.kamacoder.com/pics/20210305093200104.png) +![递归空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305093200104.png) 从图中,可以看出f(5)是由f(4)和f(3)相加而来,那么f(4)是由f(3)和f(2)相加而来 以此类推。 @@ -196,7 +196,7 @@ int main() 在看递归的深度是多少呢?如图所示: -![递归空间复杂度分析](https://file.kamacoder.com/pics/20210305094749554.png) +![递归空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305094749554.png) 递归第n个斐波那契数的话,递归调用栈的深度就是n。 @@ -214,7 +214,7 @@ int fibonacci(int i) { 最后对各种求斐波那契数列方法的性能做一下分析,如题: -![递归的空间复杂度分析](https://file.kamacoder.com/pics/20210305095227356.png) +![递归的空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305095227356.png) 可以看出,求斐波那契数的时候,使用递归算法并不一定是在性能上是最优的,但递归确实简化的代码层面的复杂度。 @@ -264,4 +264,4 @@ int binary_search( int arr[], int l, int r, int x) { ----------------------- -
+
diff --git "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" index befe549874..a02c37f2c9 100644 --- "a/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" +++ "b/problems/\345\211\215\345\272\217/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\345\244\215\346\235\202\345\272\246.md" @@ -69,7 +69,7 @@ int function3(int x, int n) { 我们来分析一下,首先看递归了多少次呢,可以把递归抽象出一棵满二叉树。刚刚同学写的这个算法,可以用一棵满二叉树来表示(为了方便表示,选择n为偶数16),如图: -![递归算法的时间复杂度](https://file.kamacoder.com/pics/20201209193909426.png) +![递归算法的时间复杂度](https://file1.kamacoder.com/i/algo/20201209193909426.png) 当前这棵二叉树就是求x的n次方,n为16的情况,n为16的时候,进行了多少次乘法运算呢? @@ -79,7 +79,7 @@ int function3(int x, int n) { 这么如果是求x的n次方,这个递归树有多少个节点呢,如下图所示:(m为深度,从0开始) -![递归求时间复杂度](https://file.kamacoder.com/pics/20200728195531892.png) +![递归求时间复杂度](https://file1.kamacoder.com/i/algo/20200728195531892.png) **时间复杂度忽略掉常数项`-1`之后,这个递归算法的时间复杂度依然是O(n)**。对,你没看错,依然是O(n)的时间复杂度! @@ -140,4 +140,4 @@ int function3(int x, int n) { ----------------------- -
+
diff --git "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" old mode 100644 new mode 100755 index a88919d4ca..547cae8a30 --- "a/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" +++ "b/problems/\345\211\221\346\214\207Offer05.\346\233\277\346\215\242\347\251\272\346\240\274.md" @@ -35,11 +35,11 @@ 如图: -![](https://file.kamacoder.com/pics/20231030165201.png) +![](https://file1.kamacoder.com/i/algo/20231030165201.png) 然后从后向前替换数字字符,也就是双指针法,过程如下:i指向新长度的末尾,j指向旧长度的末尾。 -![](https://file.kamacoder.com/pics/20231030173058.png) +![](https://file1.kamacoder.com/i/algo/20231030173058.png) 有同学问了,为什么要从后向前填充,从前向后填充不行么? diff --git "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" old mode 100644 new mode 100755 index 4c62312c8b..025073220a --- "a/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" +++ "b/problems/\345\211\221\346\214\207Offer58-II.\345\267\246\346\227\213\350\275\254\345\255\227\347\254\246\344\270\262.md" @@ -44,16 +44,16 @@ fgabcde 本题中,我们需要将字符串右移n位,字符串相当于分成了两个部分,如果n为2,符串相当于分成了两个部分,如图: (length为字符串长度) -![](https://file.kamacoder.com/pics/20231106170143.png) +![](https://file1.kamacoder.com/i/algo/20231106170143.png) 右移n位, 就是将第二段放在前面,第一段放在后面,先不考虑里面字符的顺序,是不是整体倒叙不就行了。如图: -![](https://file.kamacoder.com/pics/20231106171557.png) +![](https://file1.kamacoder.com/i/algo/20231106171557.png) 此时第一段和第二段的顺序是我们想要的,但里面的字符位置被我们倒叙,那么此时我们在把 第一段和第二段里面的字符再倒叙一把,这样字符顺序不就正确了。 如果: -![](https://file.kamacoder.com/pics/20231106172058.png) +![](https://file1.kamacoder.com/i/algo/20231106172058.png) 其实,思路就是 通过 整体倒叙,把两段子串顺序颠倒,两个段子串里的的字符在倒叙一把,**负负得正**,这样就不影响子串里面字符的顺序了。 @@ -84,7 +84,7 @@ int main() { 可以的,不过,要记得 控制好 局部反转的长度,如果先局部反转,那么先反转的子串长度就是 len - n,如图: -![](https://file.kamacoder.com/pics/20231106172534.png) +![](https://file1.kamacoder.com/i/algo/20231106172534.png) 代码如下: diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index 314fb471b1..ff73cd9606 --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222-\350\202\241\347\245\250\351\227\256\351\242\230\346\200\273\347\273\223\347\257\207.md" @@ -6,7 +6,7 @@ 之前我们已经把力扣上股票系列的题目都讲过的,但没有来一篇股票总结,来帮大家高屋建瓴,所以总结篇这就来了! -![股票问题总结](https://code-thinking.cdn.bcebos.com/pics/%E8%82%A1%E7%A5%A8%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93.jpg) +![股票问题总结](https://file1.kamacoder.com/i/algo/%E8%82%A1%E7%A5%A8%E9%97%AE%E9%A2%98%E6%80%BB%E7%BB%93.jpg) * [动态规划:121.买卖股票的最佳时机](https://programmercarl.com/0121.买卖股票的最佳时机.html) * [动态规划:122.买卖股票的最佳时机II](https://programmercarl.com/0122.买卖股票的最佳时机II(动态规划).html) diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index faca5ecb55..32df8af41c --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\346\200\273\347\273\223\347\257\207.md" @@ -51,7 +51,7 @@ ## 背包问题系列 -背包问题大纲 +背包问题大纲 * [动态规划:关于01背包问题,你该了解这些!](https://programmercarl.com/背包理论基础01背包-1.html) * [动态规划:关于01背包问题,你该了解这些!(滚动数组)](https://programmercarl.com/背包理论基础01背包-2.html) @@ -77,7 +77,7 @@ ## 股票系列 -股票问题总结 +股票问题总结 * [动态规划:买卖股票的最佳时机](https://programmercarl.com/0121.买卖股票的最佳时机.html) * [动态规划:本周我们都讲了这些(系列六)](https://programmercarl.com/周总结/20210225动规周末总结.html) @@ -91,7 +91,7 @@ ## 子序列系列 - + * [动态规划:最长递增子序列](https://programmercarl.com/0300.最长上升子序列.html) * [动态规划:最长连续递增序列](https://programmercarl.com/0674.最长连续递增序列.html) diff --git "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 634f710f9a..63f059798e --- "a/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\212\250\346\200\201\350\247\204\345\210\222\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -6,7 +6,7 @@ 动态规划刷题大纲 - + ## 算法公开课 diff --git "a/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" "b/problems/\345\217\214\346\214\207\351\222\210\346\200\273\347\273\223.md" old mode 100644 new mode 100755 diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20200927\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20200927\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" index 594656ca23..11dd298292 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20200927\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20200927\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -203,4 +203,4 @@ public: **本周我们都是讲解了二叉树,从理论基础到遍历方式,从递归到迭代,从深度遍历到广度遍历,最后再用了一个翻转二叉树的题目把我们之前讲过的遍历方式都串了起来。** -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" index 3212ca5603..5b25e9c076 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201003\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -254,5 +254,5 @@ traversal(cur->left, tmp, result); * Github:[leetcode-master](https://github.com/youngyangyang04/leetcode-master) * 知乎:[代码随想录](https://www.zhihu.com/people/sun-xiu-yang-64) -![](https://file.kamacoder.com/pics/2021013018121150.png) -
+![](https://file1.kamacoder.com/i/algo/2021013018121150.png) +
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201010\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201010\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" index 5f5f688a13..94d95efd38 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201010\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201010\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -87,4 +87,4 @@ **如果大家一路跟下来,一定收获满满,如果周末不做这个总结,大家可能都不知道自己收获满满,啊哈!** -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201017\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201017\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" index 03148b1575..5276cdde6b 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201017\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201017\344\272\214\345\217\211\346\240\221\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -116,4 +116,4 @@ 大家如果每天坚持跟下来,会发现又是充实的一周![机智] -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201030\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201030\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" index 77db9708c0..e8e2948791 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201030\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201030\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -114,4 +114,4 @@ * B站:[代码随想录](https://space.bilibili.com/525438321) * 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ) -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" index d910ce2509..9da360c2c6 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201107\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -31,7 +31,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 在[回溯算法:求组合总和(二)](https://programmercarl.com/0039.组合总和.html)第一个树形结构没有画出startIndex的作用,**这里这里纠正一下,准确的树形结构如图所示:** -![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) +![39.组合总和](https://file1.kamacoder.com/i/algo/20201223170730367.png) ## 周二 @@ -45,7 +45,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 都知道组合问题可以抽象为树形结构,那么“使用过”在这个树形结构上是有两个维度的,一个维度是同一树枝上“使用过”,一个维度是同一树层上“使用过”。**没有理解这两个层面上的“使用过” 是造成大家没有彻底理解去重的根本原因**。 -![40.组合总和II1](https://file.kamacoder.com/pics/20201123202817973.png) +![40.组合总和II1](https://file1.kamacoder.com/i/algo/20201123202817973.png) 我在图中将used的变化用橘黄色标注上,可以看出在candidates[i] == candidates[i - 1]相同的情况下: @@ -79,7 +79,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; **本题的树形结构中,和代码的逻辑有一个小出入,已经判断不是回文的子串就不会进入递归了,纠正如下:** -![131.分割回文串](https://file.kamacoder.com/pics/20201123203228309.png) +![131.分割回文串](https://file1.kamacoder.com/i/algo/20201123203228309.png) ## 周四 @@ -90,7 +90,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形图如下: -![93.复原IP地址](https://file.kamacoder.com/pics/20201123203735933-20230310133532452.png) +![93.复原IP地址](https://file1.kamacoder.com/i/algo/20201123203735933-20230310133532452.png) 在本文的树形结构图中,我已经把详细的分析思路都画了出来,相信大家看了之后一定会思路清晰不少! @@ -112,7 +112,7 @@ if (s.size() > 12) return result; // 剪枝 如图: -![78.子集](https://file.kamacoder.com/pics/202011232041348.png) +![78.子集](https://file1.kamacoder.com/i/algo/202011232041348.png) 认清这个本质之后,今天的题目就是一道模板题了。 @@ -166,4 +166,4 @@ leetcode上的计时应该是以4ms为单位,有的多提交几次,多个4ms -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" index c2e122844d..031ddc0250 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201112\345\233\236\346\272\257\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -11,14 +11,14 @@ 树形结构如下: -![90.子集II](https://file.kamacoder.com/pics/2020111217110449-20230310133150714.png) +![90.子集II](https://file1.kamacoder.com/i/algo/2020111217110449-20230310133150714.png) ## 周二 在[回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)中,处处都能看到子集的身影,但处处是陷阱,值得好好琢磨琢磨! 树形结构如下: -![491. 递增子序列1](https://file.kamacoder.com/pics/20201112170832333-20230310133155209.png) +![491. 递增子序列1](https://file1.kamacoder.com/i/algo/20201112170832333-20230310133155209.png) [回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)留言区大家有很多疑问,主要还是和[回溯算法:求子集问题(二)](https://programmercarl.com/0090.子集II.html)混合在了一起。 @@ -33,7 +33,7 @@ 可以看出元素1在[1,2]中已经使用过了,但是在[2,1]中还要在使用一次1,所以处理排列问题就不用使用startIndex了。 如图: -![46.全排列](https://file.kamacoder.com/pics/20201112170304979-20230310133201250.png) +![46.全排列](https://file1.kamacoder.com/i/algo/20201112170304979-20230310133201250.png) **大家此时可以感受出排列问题的不同:** @@ -46,7 +46,7 @@ 树形结构如下: -![47.全排列II1](https://file.kamacoder.com/pics/20201112171930470-20230310133206398.png) +![47.全排列II1](https://file1.kamacoder.com/i/algo/20201112171930470-20230310133206398.png) **这道题目神奇的地方就是used[i - 1] == false也可以,used[i - 1] == true也可以!** @@ -54,11 +54,11 @@ 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2.png](https://file.kamacoder.com/pics/20201112172230434-20230310133211392.png) +![47.全排列II2.png](https://file1.kamacoder.com/i/algo/20201112172230434-20230310133211392.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://file.kamacoder.com/pics/20201112172327967-20230310133216389.png) +![47.全排列II3](https://file1.kamacoder.com/i/algo/20201112172327967-20230310133216389.png) **可以清晰的看到使用(used[i - 1] == false),即树层去重,效率更高!** @@ -97,4 +97,4 @@ -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201126\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201126\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index 3494a32074..d934270a27 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201126\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201126\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -112,4 +112,4 @@ public: -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index 4ab1cddbff..70081e82e2 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201203\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -15,7 +15,7 @@ 如图: -![122.买卖股票的最佳时机II](https://file.kamacoder.com/pics/2020112917480858.png) +![122.买卖股票的最佳时机II](https://file1.kamacoder.com/i/algo/2020112917480858.png) ## 周二 @@ -31,7 +31,7 @@ 如图: -![55.跳跃游戏](https://file.kamacoder.com/pics/20201124154758229.png) +![55.跳跃游戏](https://file1.kamacoder.com/i/algo/20201124154758229.png) ## 周三 @@ -44,7 +44,7 @@ 如图: -![45.跳跃游戏II](https://file.kamacoder.com/pics/20201201232309103-20230310133110942.png) +![45.跳跃游戏II](https://file1.kamacoder.com/i/algo/20201201232309103-20230310133110942.png) 注意:**图中的移动下标是到当前这步覆盖的最远距离(下标2的位置),此时没有到终点,只能增加第二步来扩大覆盖范围**。 @@ -55,10 +55,10 @@ 而版本二就比较统一的,超过范围,步数就加一,但在移动下标的范围了做了文章。 即如果覆盖最远距离下标是倒数第二点:直接加一就行,默认一定可以到终点。如图: -![45.跳跃游戏II2](https://file.kamacoder.com/pics/20201201232445286-20230310133115650.png) +![45.跳跃游戏II2](https://file1.kamacoder.com/i/algo/20201201232445286-20230310133115650.png) 如果覆盖最远距离下标不是倒数第二点,说明本次覆盖已经到终点了。如图: -![45.跳跃游戏II1](https://file.kamacoder.com/pics/20201201232338693-20230310133120115.png) +![45.跳跃游戏II1](https://file1.kamacoder.com/i/algo/20201201232338693-20230310133120115.png) 有的录友认为版本一好理解,有的录友认为版本二好理解,其实掌握一种就可以了,也不用非要比拼一下代码的简洁性,简洁程度都差不多了。 @@ -92,4 +92,4 @@ -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" index f449995b01..dec7511c21 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201210\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -77,7 +77,7 @@ 文中从计算机硬件出发,分析计算机的计算性能,然后亲自做实验,整理出数据如下: -![程序超时1](https://file.kamacoder.com/pics/20201208231559175-20230310133304038.png) +![程序超时1](https://file1.kamacoder.com/i/algo/20201208231559175-20230310133304038.png) **大家有一个数量级上的概念就可以了!** @@ -120,4 +120,4 @@ 就酱,「代码随想录」是技术公众号里的一抹清流,值得推荐给身边的朋友同学们! -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index 19a95615a3..cface1c9d3 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201217\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -38,7 +38,7 @@ 如图: -![135.分发糖果](https://file.kamacoder.com/pics/20201117114916878-20230310133332759.png) +![135.分发糖果](https://file1.kamacoder.com/i/algo/20201117114916878-20230310133332759.png) 接着在贪心另一边,左孩子大于右孩子,左孩子的糖果就要比右孩子多。 @@ -50,7 +50,7 @@ 局部最优可以推出全局最优。 如图: -![135.分发糖果1](https://file.kamacoder.com/pics/20201117115658791-20230310133346127.png) +![135.分发糖果1](https://file1.kamacoder.com/i/algo/20201117115658791-20230310133346127.png) ## 周三 @@ -98,4 +98,4 @@ 而且大家也会发现,贪心并没有想象中的那么简单,贪心往往妙的出其不意,触不及防! -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" index a8ba7454eb..71abb155c6 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20201224\350\264\252\345\277\203\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -9,7 +9,7 @@ 如图: -![452.用最少数量的箭引爆气球](https://file.kamacoder.com/pics/20201123101929791-20230310133845522.png) +![452.用最少数量的箭引爆气球](https://file1.kamacoder.com/i/algo/20201123101929791-20230310133845522.png) 模拟射气球的过程,很多同学真的要去模拟了,实时把气球从数组中移走,这么写的话就复杂了,从前向后遍历重复的只要跳过就可以的。 @@ -21,7 +21,7 @@ 如图: -![435.无重叠区间](https://file.kamacoder.com/pics/20201221201553618.png) +![435.无重叠区间](https://file1.kamacoder.com/i/algo/20201221201553618.png) 细心的同学就发现了,此题和 [贪心算法:用最少数量的箭引爆气球](https://programmercarl.com/0452.用最少数量的箭引爆气球.html)非常像。 @@ -71,7 +71,7 @@ public: 如图: -![763.划分字母区间](https://file.kamacoder.com/pics/20201222191924417-20230310133855435.png) +![763.划分字母区间](https://file1.kamacoder.com/i/algo/20201222191924417-20230310133855435.png) ## 周四 @@ -86,7 +86,7 @@ public: 如图: -![56.合并区间](https://file.kamacoder.com/pics/20201223200632791-20230310133859587.png) +![56.合并区间](https://file1.kamacoder.com/i/algo/20201223200632791-20230310133859587.png) ## 总结 @@ -102,4 +102,4 @@ public: **「代码随想录」里总结的都是经典题目,大家跟着练就节省了不少选择题目的时间了**。 -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210107\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210107\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index da2ebd3051..e74907013c 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210107\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210107\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -150,4 +150,4 @@ public: -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 1b6bd84bcc..7cedf63919 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210114\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -31,7 +31,7 @@ for (int i = 1; i < m; i++) { } ``` -![62.不同路径1](https://file.kamacoder.com/pics/20201209113631392-20230310133703294.png) +![62.不同路径1](https://file1.kamacoder.com/i/algo/20201209113631392-20230310133703294.png) ## 周二 @@ -45,7 +45,7 @@ dp[i][j]定义依然是:表示从(0 ,0)出发,到(i, j) 有dp[i][j]条 如图: -![63.不同路径II](https://file.kamacoder.com/pics/20210104114513928-20230310133707783.png) +![63.不同路径II](https://file1.kamacoder.com/i/algo/20210104114513928-20230310133707783.png) 这里难住了不少同学,代码如下: @@ -70,11 +70,11 @@ for (int i = 1; i < m; i++) { 拿示例1来举例如题: -![63.不同路径II1](https://file.kamacoder.com/pics/20210104114548983-20230310133711888.png) +![63.不同路径II1](https://file1.kamacoder.com/i/algo/20210104114548983-20230310133711888.png) 对应的dp table 如图: -![63.不同路径II2](https://file.kamacoder.com/pics/20210104114610256-20230310133715981.png) +![63.不同路径II2](https://file1.kamacoder.com/i/algo/20210104114610256-20230310133715981.png) ## 周三 @@ -111,7 +111,7 @@ for (int i = 3; i <= n ; i++) { 举例当n为10 的时候,dp数组里的数值,如下: -![343.整数拆分](https://file.kamacoder.com/pics/20210104173021581-20230310133720552.png) +![343.整数拆分](https://file1.kamacoder.com/i/algo/20210104173021581-20230310133720552.png) @@ -143,7 +143,7 @@ dp数组如何初始化:只需要初始化dp[0]就可以了,推导的基础 n为5时候的dp数组状态如图: -![96.不同的二叉搜索树3](https://file.kamacoder.com/pics/20210107093253987-20230310133724531.png) +![96.不同的二叉搜索树3](https://file1.kamacoder.com/i/algo/20210107093253987-20230310133724531.png) ## 总结 @@ -153,4 +153,4 @@ n为5时候的dp数组状态如图: **但我还会坚持规划好的路线,难度循序渐进,并以面试经典题目为准,该简单的时候就是简单,同时也不会因为阅读量低就放弃有难度的题目!**。 -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index dc32891da8..8ae7882e61 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210121\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -17,7 +17,7 @@ 关于其他几种常用的背包,大家看这张图就了然于胸了: -![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407-20230310133624872.png) +![416.分割等和子集1](https://file1.kamacoder.com/i/algo/20210117171307407-20230310133624872.png) 本文用动规五部曲详细讲解了01背包的二维dp数组的实现方法,大家其实可以发现最简单的是推导公式了,推导公式估计看一遍就记下来了,但难就难在确定初始化和遍历顺序上。 @@ -70,7 +70,7 @@ for(int i = 1; i < weight.size(); i++) { // 遍历物品 来看一下对应的dp数组的数值,如图: -![动态规划-背包问题4](https://file.kamacoder.com/pics/20210118163425129-20230310133630224.jpg) +![动态规划-背包问题4](https://file1.kamacoder.com/i/algo/20210118163425129-20230310133630224.jpg) 最终结果就是dp[2][4]。 @@ -122,7 +122,7 @@ for(int i = 0; i < weight.size(); i++) { // 遍历物品 一维dp,分别用物品0,物品1,物品2 来遍历背包,最终得到结果如下: -![动态规划-背包问题9](https://file.kamacoder.com/pics/20210110103614769-20230310133634873.png) +![动态规划-背包问题9](https://file1.kamacoder.com/i/algo/20210110103614769-20230310133634873.png) ## 周三 @@ -160,4 +160,4 @@ for(int i = 0; i < weight.size(); i++) { // 遍历物品 就像是我们讲解01背包的时候,花了那么大力气才把每一个细节都讲清楚,这里其实是基础,后面的背包问题怎么变,基础比较牢固自然会有自己的一套思考过程。 -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 8598ec69f0..ff3b771aa8 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210128\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -35,7 +35,7 @@ bagSize = (S + sum) / 2 = (3 + 5) / 2 = 4 dp数组状态变化如下: -![494.目标和](https://file.kamacoder.com/pics/20210125120743274-20230310132918821.jpg) +![494.目标和](https://file1.kamacoder.com/i/algo/20210125120743274-20230310132918821.jpg) ## 周二 @@ -73,7 +73,7 @@ dp[i][j] = max(dp[i][j], dp[i - zeroNum][j - oneNum] + 1); 最后dp数组的状态如下所示: -![474.一和零](https://file.kamacoder.com/pics/20210120111201512-20230310132936011.jpg) +![474.一和零](https://file1.kamacoder.com/i/algo/20210120111201512-20230310132936011.jpg) ## 周三 @@ -140,4 +140,4 @@ for(int i = 0; i < weight.size(); i++) { // 遍历物品 此时相信大家对动规五部曲也有更深的理解了,同样也验证了Carl之前讲过的:**简单题是用来学习方法论的,而遇到难题才体现出方法论的重要性!** -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210204\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210204\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index fb570bd402..e1e6baf503 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210204\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210204\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -200,4 +200,4 @@ public: 此时我们就已经把完全背包的遍历顺序研究的透透的了! -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 309f277f6a..b17a682972 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210225\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -30,7 +30,7 @@ dp[1] = max(nums[0], nums[1]); 以示例二,输入[2,7,9,3,1]为例。 -![198.打家劫舍](https://file.kamacoder.com/pics/20210221170954115-20230310133425353.jpg) +![198.打家劫舍](https://file1.kamacoder.com/i/algo/20210221170954115-20230310133425353.jpg) 红框dp[nums.size() - 1]为结果。 @@ -42,15 +42,15 @@ dp[1] = max(nums[0], nums[1]); * 情况一:考虑不包含首尾元素 -![213.打家劫舍II](https://file.kamacoder.com/pics/20210129160748643.jpg) +![213.打家劫舍II](https://file1.kamacoder.com/i/algo/20210129160748643.jpg) * 情况二:考虑包含首元素,不包含尾元素 -![213.打家劫舍II1](https://file.kamacoder.com/pics/20210129160821374.jpg) +![213.打家劫舍II1](https://file1.kamacoder.com/i/algo/20210129160821374.jpg) * 情况三:考虑包含尾元素,不包含首元素 -![213.打家劫舍II2](https://file.kamacoder.com/pics/20210129160842491.jpg) +![213.打家劫舍II2](https://file1.kamacoder.com/i/algo/20210129160842491.jpg) 需要注意的是,**“考虑” 不等于 “偷”**,例如情况三,虽然是考虑包含尾元素,但不一定要选尾部元素!对于情况三,取nums[1] 和 nums[3]就是最大的。 @@ -178,7 +178,7 @@ return {val2, val1}; 以示例1为例,dp数组状态如下:(**注意用后序遍历的方式推导**) -![337.打家劫舍III](https://file.kamacoder.com/pics/20210129181331613.jpg) +![337.打家劫舍III](https://file1.kamacoder.com/i/algo/20210129181331613.jpg) **最后头结点就是 取下标0 和 下标1的最大值就是偷得的最大金钱**。 @@ -306,4 +306,4 @@ public: **代码随想录温馨提醒:投资有风险,入市需谨慎!** -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" "b/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" index 5d84fb1915..0749becbba 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/20210304\345\212\250\350\247\204\345\221\250\346\234\253\346\200\273\347\273\223.md" @@ -77,7 +77,7 @@ dp[0][4] = 0; 以输入[1,2,3,4,5]为例 -![123.买卖股票的最佳时机III](https://file.kamacoder.com/pics/20201228181724295.png) +![123.买卖股票的最佳时机III](https://file1.kamacoder.com/i/algo/20201228181724295.png) 可以看到红色框为最后两次卖出的状态。 @@ -144,7 +144,7 @@ for (int j = 1; j < 2 * k; j += 2) { 以输入[1,2,3,4,5],k=2为例。 -![188.买卖股票的最佳时机IV](https://file.kamacoder.com/pics/20201229100358221-20230310133805763.png) +![188.买卖股票的最佳时机IV](https://file1.kamacoder.com/i/algo/20201229100358221-20230310133805763.png) 最后一次卖出,一定是利润最大的,dp[prices.size() - 1][2 * k]即红色部分就是最后求解。 @@ -197,7 +197,7 @@ vector> dp(n, vector(3, 0)); 以 [1,2,3,0,2] 为例,dp数组如下: -![309.最佳买卖股票时机含冷冻期](https://file.kamacoder.com/pics/20201229163725348.png) +![309.最佳买卖股票时机含冷冻期](https://file1.kamacoder.com/i/algo/20201229163725348.png) 最后两个状态 不持有股票(能购买) 和 不持有股票(冷冻期)都有可能最后结果,取最大的。 @@ -206,4 +206,4 @@ vector> dp(n, vector(3, 0)); 下周还会有一篇股票系列的文章,**股票系列后面我也会单独写一篇总结,来高度概括一下,这样大家会对股票问题就有一个整体性的理解了**。 -
+
diff --git "a/problems/\345\221\250\346\200\273\347\273\223/\344\272\214\345\217\211\346\240\221\351\230\266\346\256\265\346\200\273\347\273\223\347\263\273\345\210\227\344\270\200.md" "b/problems/\345\221\250\346\200\273\347\273\223/\344\272\214\345\217\211\346\240\221\351\230\266\346\256\265\346\200\273\347\273\223\347\263\273\345\210\227\344\270\200.md" index 52e2fec11f..6cbf6e2a77 100644 --- "a/problems/\345\221\250\346\200\273\347\273\223/\344\272\214\345\217\211\346\240\221\351\230\266\346\256\265\346\200\273\347\273\223\347\263\273\345\210\227\344\270\200.md" +++ "b/problems/\345\221\250\346\200\273\347\273\223/\344\272\214\345\217\211\346\240\221\351\230\266\346\256\265\346\200\273\347\273\223\347\263\273\345\210\227\344\270\200.md" @@ -206,4 +206,4 @@ public: **本周我们都是讲解了二叉树,从理论基础到遍历方式,从递归到迭代,从深度遍历到广度遍历,最后再用了一个翻转二叉树的题目把我们之前讲过的遍历方式都串了起来。** -
+
diff --git "a/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" "b/problems/\345\223\210\345\270\214\350\241\250\346\200\273\347\273\223.md" old mode 100644 new mode 100755 diff --git "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 92b590bc89..e3400ad7f0 --- "a/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\223\210\345\270\214\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -18,7 +18,7 @@ 哈希表中关键码就是数组的索引下标,然后通过下标直接访问数组中的元素,如下图所示: -![哈希表1](https://file.kamacoder.com/pics/20210104234805168.png) +![哈希表1](https://file1.kamacoder.com/i/algo/20210104234805168.png) 那么哈希表能解决什么问题呢,**一般哈希表都是用来快速判断一个元素是否出现集合里。** @@ -36,7 +36,7 @@ 哈希函数如下图所示,通过hashCode把名字转化为数值,一般hashcode是通过特定编码方式,可以将其他数据格式转化为不同的数值,这样就把学生名字映射为哈希表上的索引数字了。 -![哈希表2](https://file.kamacoder.com/pics/2021010423484818.png) +![哈希表2](https://file1.kamacoder.com/i/algo/2021010423484818.png) 如果hashCode得到的数值大于 哈希表的大小了,也就是大于tableSize了,怎么办呢? @@ -52,7 +52,7 @@ 如图所示,小李和小王都映射到了索引下标 1 的位置,**这一现象叫做哈希碰撞**。 -![哈希表3](https://file.kamacoder.com/pics/2021010423494884.png) +![哈希表3](https://file1.kamacoder.com/i/algo/2021010423494884.png) 一般哈希碰撞有两种解决方法, 拉链法和线性探测法。 @@ -60,7 +60,7 @@ 刚刚小李和小王在索引1的位置发生了冲突,发生冲突的元素都被存储在链表中。 这样我们就可以通过索引找到小李和小王了 -![哈希表4](https://file.kamacoder.com/pics/20210104235015226.png) +![哈希表4](https://file1.kamacoder.com/i/algo/20210104235015226.png) (数据规模是dataSize, 哈希表的大小为tableSize) @@ -72,7 +72,7 @@ 例如冲突的位置,放了小李,那么就向下找一个空位放置小王的信息。所以要求tableSize一定要大于dataSize ,要不然哈希表上就没有空置的位置来存放 冲突的数据了。如图所示: -![哈希表5](https://file.kamacoder.com/pics/20210104235109950.png) +![哈希表5](https://file1.kamacoder.com/i/algo/20210104235109950.png) 其实关于哈希碰撞还有非常多的细节,感兴趣的同学可以再好好研究一下,这里我就不再赘述了。 @@ -117,7 +117,7 @@ std::unordered_map 底层实现为哈希表,std::map 和std::multimap 的底 实际上功能都是一样一样的, 但是unordered_set在C++11的时候被引入标准库了,而hash_set并没有,所以建议还是使用unordered_set比较好,这就好比一个是官方认证的,hash_set,hash_map 是C++11标准之前民间高手自发造的轮子。 -![哈希表6](https://file.kamacoder.com/pics/20210104235134572.png) +![哈希表6](https://file1.kamacoder.com/i/algo/20210104235134572.png) ## 总结 diff --git "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" old mode 100644 new mode 100755 index 8fd69d518e..7a7929f41a --- "a/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" +++ "b/problems/\345\233\236\346\272\257\346\200\273\347\273\223.md" @@ -63,7 +63,7 @@ void backtracking(参数) { 本题我把回溯问题抽象为树形结构,如题: -![77.组合1](https://file.kamacoder.com/pics/20201118152928844.png) +![77.组合1](https://file1.kamacoder.com/i/algo/20201118152928844.png) 可以直观的看出其搜索的过程:**for循环横向遍历,递归纵向遍历,回溯不断调整结果集**,这个理念贯穿整个回溯法系列,也是我做了很多回溯的题目,不断摸索其规律才总结出来的。 @@ -73,7 +73,7 @@ void backtracking(参数) { 优化回溯算法只有剪枝一种方法,在[回溯算法:组合问题再剪剪枝](https://programmercarl.com/0077.组合优化.html)中把回溯法代码做了剪枝优化,树形结构如图: -![77.组合4](https://file.kamacoder.com/pics/20201118153133458.png) +![77.组合4](https://file1.kamacoder.com/i/algo/20201118153133458.png) 大家可以一目了然剪的究竟是哪里。 @@ -89,11 +89,11 @@ void backtracking(参数) { 在[回溯算法:求组合总和!](https://programmercarl.com/0216.组合总和III.html)中,相当于 [回溯算法:求组合问题!](https://programmercarl.com/0077.组合.html)加了一个元素总和的限制。 树形结构如图: -![216.组合总和III](https://file.kamacoder.com/pics/20201118201921245.png) +![216.组合总和III](https://file1.kamacoder.com/i/algo/20201118201921245.png) 整体思路还是一样的,本题的剪枝会好想一些,即:**已选元素总和如果已经大于n(题中要求的和)了,那么往后遍历就没有意义了,直接剪掉**,如图: -![216.组合总和III1](https://file.kamacoder.com/pics/20201118202038240.png) +![216.组合总和III1](https://file1.kamacoder.com/i/algo/20201118202038240.png) 在本题中,依然还可以有一个剪枝,就是[回溯算法:组合问题再剪剪枝](https://programmercarl.com/0077.组合优化.html)中提到的,对for循环选择的起始范围的剪枝。 @@ -114,7 +114,7 @@ void backtracking(参数) { **注意以上我只是说求组合的情况,如果是排列问题,又是另一套分析的套路**。 树形结构如下: -![39.组合总和](https://file.kamacoder.com/pics/20201223170730367.png) +![39.组合总和](https://file1.kamacoder.com/i/algo/20201223170730367.png) 最后还给出了本题的剪枝优化,如下: @@ -125,7 +125,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 优化后树形结构如下: -![39.组合总和1](https://file.kamacoder.com/pics/20201118202115929.png) +![39.组合总和1](https://file1.kamacoder.com/i/algo/20201118202115929.png) #### 组合总和(三) @@ -140,7 +140,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 都知道组合问题可以抽象为树形结构,那么“使用过”在这个树形结构上是有两个维度的,一个维度是同一树枝上“使用过”,一个维度是同一树层上“使用过”。**没有理解这两个层面上的“使用过” 是造成大家没有彻底理解去重的根本原因**。 -![40.组合总和II1](https://file.kamacoder.com/pics/2020111820220675.png) +![40.组合总和II1](https://file1.kamacoder.com/i/algo/2020111820220675.png) 我在图中将used的变化用橘黄色标注上,**可以看出在candidates[i] == candidates[i - 1]相同的情况下:** @@ -161,7 +161,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形结构如下: -![17. 电话号码的字母组合](https://file.kamacoder.com/pics/20201118202335724.png) +![17. 电话号码的字母组合](https://file1.kamacoder.com/i/algo/20201118202335724.png) 如果大家在现场面试的时候,一定要注意各种输入异常的情况,例如本题输入1 * #按键。 @@ -189,7 +189,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 树形结构如下: -![131.分割回文串](https://file.kamacoder.com/pics/20201118202448642.png) +![131.分割回文串](https://file1.kamacoder.com/i/algo/20201118202448642.png) ## 子集问题 @@ -200,7 +200,7 @@ for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; 如图: -![78.子集](https://file.kamacoder.com/pics/20201118202544339.png) +![78.子集](https://file1.kamacoder.com/i/algo/20201118202544339.png) 认清这个本质之后,今天的题目就是一道模板题了。 @@ -227,14 +227,14 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树形结构如下: -![90.子集II](https://file.kamacoder.com/pics/2020111217110449.png) +![90.子集II](https://file1.kamacoder.com/i/algo/2020111217110449.png) ### 递增子序列 在[回溯算法:递增子序列](https://programmercarl.com/0491.递增子序列.html)中,处处都能看到子集的身影,但处处是陷阱,值得好好琢磨琢磨! 树形结构如下: -![491. 递增子序列1](https://file.kamacoder.com/pics/20201112170832333.png) +![491. 递增子序列1](https://file1.kamacoder.com/i/algo/20201112170832333.png) 很多同学都会把这道题目和[回溯算法:求子集问题(二)](https://programmercarl.com/0090.子集II.html)混在一起。 @@ -243,7 +243,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 我用没有排序的集合{2,1,2,2}来举个例子画一个图,如下: -![90.子集II2](https://file.kamacoder.com/pics/2020111316440479.png) +![90.子集II2](https://file1.kamacoder.com/i/algo/2020111316440479.png) **相信这个图胜过千言万语的解释了**。 @@ -259,7 +259,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 如图: -![46.全排列](https://file.kamacoder.com/pics/20201112170304979.png) +![46.全排列](https://file1.kamacoder.com/i/algo/20201112170304979.png) **大家此时可以感受出排列问题的不同:** @@ -272,7 +272,7 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树形结构如下: -![47.全排列II1](https://file.kamacoder.com/pics/20201112171930470.png) +![47.全排列II1](https://file1.kamacoder.com/i/algo/20201112171930470.png) **这道题目神奇的地方就是used[i - 1] == false也可以,used[i - 1] == true也可以!** @@ -280,11 +280,11 @@ if (startIndex >= nums.size()) { // 终止条件可以不加 树层上去重(used[i - 1] == false),的树形结构如下: -![47.全排列II2.png](https://file.kamacoder.com/pics/20201112172230434.png) +![47.全排列II2.png](https://file1.kamacoder.com/i/algo/20201112172230434.png) 树枝上去重(used[i - 1] == true)的树型结构如下: -![47.全排列II3](https://file.kamacoder.com/pics/20201112172327967.png) +![47.全排列II3](https://file1.kamacoder.com/i/algo/20201112172327967.png) **可以清晰的看到使用(used[i - 1] == false),即树层去重,效率更高!** @@ -318,7 +318,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 以输入:[["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]为例,抽象为树形结构如下: -![](https://file.kamacoder.com/pics/2020111518065555.png) +![](https://file1.kamacoder.com/i/algo/2020111518065555.png) 本题可以算是一道hard的题目了,关于本题的难点我在文中已经详细列出。 @@ -335,7 +335,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 下面我用一个3 * 3 的棋盘,将搜索过程抽象为一棵树,如图: -![51.N皇后](https://file.kamacoder.com/pics/20201118225433127.png) +![51.N皇后](https://file1.kamacoder.com/i/algo/20201118225433127.png) 从图中,可以看出,二维矩阵中矩阵的高就是这棵树的高度,矩阵的宽就是树形结构中每一个节点的宽度。 @@ -363,7 +363,7 @@ used数组可是全局变量,每层与每层之间公用一个used数组,所 因为这个树形结构太大了,我抽取一部分,如图所示: -![37.解数独](https://file.kamacoder.com/pics/2020111720451790.png) +![37.解数独](https://file1.kamacoder.com/i/algo/2020111720451790.png) 解数独可以说是非常难的题目了,如果还一直停留在一维递归的逻辑中,这道题目可以让大家瞬间崩溃。 @@ -438,7 +438,7 @@ N皇后问题分析: 回溯专题汇聚为一张图: -![](https://file.kamacoder.com/pics/20211030124742.png) +![](https://file1.kamacoder.com/i/algo/20211030124742.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[莫非毛](https://wx.zsxq.com/dweb2/index/footprint/828844212542),所画,总结的非常好,分享给大家。 diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" old mode 100644 new mode 100755 index 5c20f562b6..5e2c9345c4 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\345\216\273\351\207\215\351\227\256\351\242\230\347\232\204\345\217\246\344\270\200\347\247\215\345\206\231\346\263\225.md" @@ -15,7 +15,7 @@ 我用没有排序的集合{2,1,2,2}来举例子画一个图,如图: -![90.子集II2](https://file.kamacoder.com/pics/2020111316440479-20230310121930316.png) +![90.子集II2](https://file1.kamacoder.com/i/algo/2020111316440479-20230310121930316.png) 图中,大家就很明显的看到,子集重复了。 @@ -95,7 +95,7 @@ private: 如图: -![90.子集II1](https://file.kamacoder.com/pics/202011131625054.png) +![90.子集II1](https://file1.kamacoder.com/i/algo/202011131625054.png) 可以看出一旦把unordered_set uset放在类成员位置,它控制的就是整棵树,包括树枝。 diff --git "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index d31e9651b8..c17e0be3f6 --- "a/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\345\233\236\346\272\257\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -6,7 +6,7 @@ ## 题目分类 -回溯算法大纲 +回溯算法大纲 ## 算法公开课 @@ -114,7 +114,7 @@ if (终止条件) { 如图: -![回溯算法理论基础](https://file.kamacoder.com/pics/20210130173631174.png) +![回溯算法理论基础](https://file1.kamacoder.com/i/algo/20210130173631174.png) 注意图中,我特意举例集合大小和孩子的数量是相等的! diff --git "a/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" "b/problems/\345\255\227\347\254\246\344\270\262\346\200\273\347\273\223.md" old mode 100644 new mode 100755 diff --git "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index e29a7bd379..98ba371fdc --- "a/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\346\225\260\347\273\204\346\200\273\347\273\223\347\257\207.md" @@ -18,7 +18,7 @@ 举一个字符数组的例子,如图所示: - + 需要两点注意的是 @@ -29,7 +29,7 @@ 例如删除下标为3的元素,需要对下标为3的元素后面的所有元素都要做移动操作,如图所示: - + 而且大家如果使用C++的话,要注意vector 和 array的区别,vector的底层实现是array,严格来讲vector是容器,不是数组。 @@ -37,7 +37,7 @@ 那么二维数组直接上图,大家应该就知道怎么回事了 - + **那么二维数组在内存的空间地址是连续的么?** @@ -45,7 +45,7 @@ 看了下图,就应该明白了: - + 所以**Java的二维数组在内存中不是 `3*4` 的连续地址空间,而是四条连续的地址空间组成!** @@ -125,7 +125,7 @@ ## 总结 -![](https://file.kamacoder.com/pics/数组总结.png) +![](https://file1.kamacoder.com/i/algo/数组总结.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画,总结的非常好,分享给大家。 diff --git "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 4000208a9b..49c41f5abb --- "a/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\225\260\347\273\204\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -18,7 +18,7 @@ 举一个字符数组的例子,如图所示: -![算法通关数组](https://code-thinking.cdn.bcebos.com/pics/%E7%AE%97%E6%B3%95%E9%80%9A%E5%85%B3%E6%95%B0%E7%BB%84.png) +![算法通关数组](https://file1.kamacoder.com/i/algo/%E7%AE%97%E6%B3%95%E9%80%9A%E5%85%B3%E6%95%B0%E7%BB%84.png) @@ -31,7 +31,7 @@ 例如删除下标为3的元素,需要对下标为3的元素后面的所有元素都要做移动操作,如图所示: -![算法通关数组1](https://code-thinking.cdn.bcebos.com/pics/%E7%AE%97%E6%B3%95%E9%80%9A%E5%85%B3%E6%95%B0%E7%BB%841.png) +![算法通关数组1](https://file1.kamacoder.com/i/algo/%E7%AE%97%E6%B3%95%E9%80%9A%E5%85%B3%E6%95%B0%E7%BB%841.png) 而且大家如果使用C++的话,要注意vector 和 array的区别,vector的底层实现是array,严格来讲vector是容器,不是数组。 @@ -40,7 +40,7 @@ 那么二维数组直接上图,大家应该就知道怎么回事了 -![](https://file.kamacoder.com/pics/20240606105522.png) +![](https://file1.kamacoder.com/i/algo/20240606105522.png) **那么二维数组在内存的空间地址是连续的么?** @@ -80,7 +80,7 @@ int main() { 如图: -![数组内存](https://file.kamacoder.com/pics/20210310150641186.png) +![数组内存](https://file1.kamacoder.com/i/algo/20210310150641186.png) **所以可以看出在C++中二维数组在地址空间上是连续的**。 @@ -111,7 +111,7 @@ public static void test_arr() { 所以Java的二维数组可能是如下排列的方式: -![算法通关数组3](https://file.kamacoder.com/pics/20201214111631844.png) +![算法通关数组3](https://file1.kamacoder.com/i/algo/20201214111631844.png) 这里面试中数组相关的理论知识就介绍完了。 diff --git "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\346\200\273\347\273\223.md" old mode 100644 new mode 100755 diff --git "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 912bfe1d70..0d3cc3a0c7 --- "a/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\346\240\210\344\270\216\351\230\237\345\210\227\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -11,7 +11,7 @@ 如图所示: -![栈与队列理论1](https://file.kamacoder.com/pics/20210104235346563.png) +![栈与队列理论1](https://file1.kamacoder.com/i/algo/20210104235346563.png) 那么我这里再列出四个关于栈的问题,大家可以思考一下。以下是以C++为例,使用其他编程语言的同学也对应思考一下,自己使用的编程语言里栈和队列是什么样的。 @@ -46,7 +46,7 @@ C++标准库是有多个版本的,要知道我们使用的STL是哪个版本 来说一说栈,栈先进后出,如图所示: -![栈与队列理论2](https://file.kamacoder.com/pics/20210104235434905.png) +![栈与队列理论2](https://file1.kamacoder.com/i/algo/20210104235434905.png) 栈提供push 和 pop 等等接口,所有元素必须符合先进后出规则,所以栈不提供走访功能,也不提供迭代器(iterator)。 不像是set 或者map 提供迭代器iterator来遍历所有元素。 @@ -59,7 +59,7 @@ C++标准库是有多个版本的,要知道我们使用的STL是哪个版本 从下图中可以看出,栈的内部结构,栈的底层实现可以是vector,deque,list 都是可以的, 主要就是数组和链表的底层实现。 -![栈与队列理论3](https://file.kamacoder.com/pics/20210104235459376.png) +![栈与队列理论3](https://file1.kamacoder.com/i/algo/20210104235459376.png) **我们常用的SGI STL,如果没有指定底层实现的话,默认是以deque为缺省情况下栈的底层结构。** diff --git "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" old mode 100644 new mode 100755 index 162ee273e3..a3566268a1 --- "a/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" +++ "b/problems/\346\240\271\346\215\256\350\272\253\351\253\230\351\207\215\345\273\272\351\230\237\345\210\227\357\274\210vector\345\216\237\347\220\206\350\256\262\350\247\243\357\274\211.md" @@ -35,7 +35,7 @@ public: ``` 耗时如下: -![vectorinsert](https://file.kamacoder.com/pics/20201218203611181.png) +![vectorinsert](https://file1.kamacoder.com/i/algo/20201218203611181.png) 其直观上来看数组的insert操作是O(n)的,整体代码的时间复杂度是O(n^2)。 @@ -68,7 +68,7 @@ public: 耗时如下: -![使用链表](https://file.kamacoder.com/pics/20201218200756257.png) +![使用链表](https://file1.kamacoder.com/i/algo/20201218200756257.png) 大家都知道对于普通数组,一旦定义了大小就不能改变,例如int a[10];,这个数组a至多只能放10个元素,改不了的。 @@ -95,7 +95,7 @@ for (int i = 0; i < vec.size(); i++) { 就是重新申请一个二倍于原数组大小的数组,然后把数据都拷贝过去,并释放原数组内存。(对,就是这么原始粗暴的方法!) 举一个例子,如图: -![vector原理](https://file.kamacoder.com/pics/20201218185902217.png) +![vector原理](https://file1.kamacoder.com/i/algo/20201218185902217.png) 原vector中的size和capicity相同都是3,初始化为1 2 3,此时要push_back一个元素4。 @@ -138,7 +138,7 @@ public: 耗时如下: -![vector手动模拟insert](https://file.kamacoder.com/pics/20201218200626718.png) +![vector手动模拟insert](https://file1.kamacoder.com/i/algo/20201218200626718.png) 这份代码就是不让vector动态扩容,全程我们自己模拟insert的操作,大家也可以直观的看出是一个O(n^2)的方法了。 diff --git "a/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" "b/problems/\347\256\227\346\263\225\346\250\241\346\235\277.md" old mode 100644 new mode 100755 diff --git "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index 9ce3fdda98..3f3841e1a2 --- "a/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\203\214\345\214\205\346\200\273\347\273\223\347\257\207.md" @@ -11,7 +11,7 @@ 关于这几种常见的背包,其关系如下: -![416.分割等和子集1](https://file.kamacoder.com/pics/20230310000726.png) +![416.分割等和子集1](https://file1.kamacoder.com/i/algo/20230310000726.png) 通过这个图,可以很清晰分清这几种常见背包之间的关系。 @@ -93,7 +93,7 @@ 背包问题总结: -![](https://file.kamacoder.com/pics/背包问题1.jpeg) +![](https://file1.kamacoder.com/i/algo/背包问题1.jpeg) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画结的非常好,分享给大家。 diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" old mode 100644 new mode 100755 index 79751c89e9..d3258c425e --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-1.md" @@ -21,7 +21,7 @@ 如果这几种背包,分不清,我这里画了一个图,如下: -![416.分割等和子集1](https://file.kamacoder.com/pics/20210117171307407.png) +![416.分割等和子集1](https://file1.kamacoder.com/i/algo/20210117171307407.png) 除此以外其他类型的背包,面试几乎不会问,都是竞赛级别的了,leetcode上连多重背包的题目都没有,所以题库也告诉我们,01背包和完全背包就够用了。 @@ -77,7 +77,7 @@ leetcode上没有纯01背包的问题,都是01背包应用方面的题目, 如图,二维数组为 dp[i][j]。 -![动态规划-背包问题1](https://file.kamacoder.com/pics/20210110103003361.png) +![动态规划-背包问题1](https://file1.kamacoder.com/i/algo/20210110103003361.png) 那么这里 i 、j、dp[i][j] 分别表示什么呢? @@ -91,7 +91,7 @@ i 来表示物品、j表示背包容量。 我们先看把物品0 放入背包的情况: -![](https://file.kamacoder.com/pics/20240730113455.png) +![](https://file1.kamacoder.com/i/algo/20240730113455.png) 背包容量为0,放不下物品0,此时背包里的价值为0。 @@ -103,7 +103,7 @@ i 来表示物品、j表示背包容量。 再看把物品1 放入背包: -![](https://file.kamacoder.com/pics/20240730114228.png) +![](https://file1.kamacoder.com/i/algo/20240730114228.png) 背包容量为 0,放不下物品0 或者物品1,此时背包里的价值为0。 @@ -150,7 +150,7 @@ i 来表示物品、j表示背包容量。 推导方向如图: -![](https://file.kamacoder.com/pics/20240730174246.png) +![](https://file1.kamacoder.com/i/algo/20240730174246.png) 如果放物品1, **那么背包要先留出物品1的容量**,目前容量是4,物品1 的容量(就是物品1的重量)为3,此时背包剩下容量为1。 @@ -158,7 +158,7 @@ i 来表示物品、j表示背包容量。 所以 放物品1 的情况 = dp[0][1] + 物品1 的价值,推导方向如图: -![](https://file.kamacoder.com/pics/20240730174436.png) +![](https://file1.kamacoder.com/i/algo/20240730174436.png) 两种情况,分别是放物品1 和 不放物品1,我们要取最大值(毕竟求的是最大价值) @@ -178,7 +178,7 @@ i 来表示物品、j表示背包容量。 首先从dp[i][j]的定义出发,如果背包容量j为0的话,即dp[i][0],无论是选取哪些物品,背包价值总和一定为0。如图: -![动态规划-背包问题2](https://file.kamacoder.com/pics/2021011010304192.png) +![动态规划-背包问题2](https://file1.kamacoder.com/i/algo/2021011010304192.png) 在看其他情况。 @@ -205,7 +205,7 @@ for (int j = weight[0]; j <= bagweight; j++) { 此时dp数组初始化情况如图所示: -![动态规划-背包问题7](https://file.kamacoder.com/pics/20210110103109140.png) +![动态规划-背包问题7](https://file1.kamacoder.com/i/algo/20210110103109140.png) dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化多少呢? @@ -217,7 +217,7 @@ dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化 如图: -![动态规划-背包问题10](https://file.kamacoder.com/pics/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92-%E8%83%8C%E5%8C%85%E9%97%AE%E9%A2%9810.jpg) +![动态规划-背包问题10](https://file1.kamacoder.com/i/algo/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92-%E8%83%8C%E5%8C%85%E9%97%AE%E9%A2%9810.jpg) 最后初始化代码如下: @@ -236,7 +236,7 @@ for (int j = weight[0]; j <= bagweight; j++) { 在如下图中,可以看出,有两个遍历的维度:物品与背包重量 -![动态规划-背包问题3](https://file.kamacoder.com/pics/2021011010314055.png) +![动态规划-背包问题3](https://file1.kamacoder.com/i/algo/2021011010314055.png) 那么问题来了,**先遍历 物品还是先遍历背包重量呢?** @@ -277,11 +277,11 @@ for(int j = 0; j <= bagweight; j++) { // 遍历背包容量 dp[i-1][j]和dp[i - 1][j - weight[i]] 都在dp[i][j]的左上角方向(包括正上方向),那么先遍历物品,再遍历背包的过程如图所示: -![动态规划-背包问题5](https://file.kamacoder.com/pics/202101101032124.png) +![动态规划-背包问题5](https://file1.kamacoder.com/i/algo/202101101032124.png) 再来看看先遍历背包,再遍历物品呢,如图: -![动态规划-背包问题6](https://file.kamacoder.com/pics/20210110103244701.png) +![动态规划-背包问题6](https://file1.kamacoder.com/i/algo/20210110103244701.png) **大家可以看出,虽然两个for循环遍历的次序不同,但是dp[i][j]所需要的数据就是左上角,根本不影响dp[i][j]公式的推导!** @@ -293,7 +293,7 @@ dp[i-1][j]和dp[i - 1][j - weight[i]] 都在dp[i][j]的左上角方向(包括 来看一下对应的dp数组的数值,如图: -![动态规划-背包问题4](https://file.kamacoder.com/pics/20210118163425129.jpg) +![动态规划-背包问题4](https://file1.kamacoder.com/i/algo/20210118163425129.jpg) 最终结果就是dp[2][4]。 diff --git "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" old mode 100644 new mode 100755 index b6a68960a9..00dc593417 --- "a/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" +++ "b/problems/\350\203\214\345\214\205\347\220\206\350\256\272\345\237\272\347\241\20001\350\203\214\345\214\205-2.md" @@ -163,7 +163,7 @@ dp[1] = dp[1 - weight[0]] + value[0] = 15 一维dp,分别用物品0,物品1,物品2 来遍历背包,最终得到结果如下: -![动态规划-背包问题9](https://file.kamacoder.com/pics/20210110103614769.png) +![动态规划-背包问题9](https://file1.kamacoder.com/i/algo/20210110103614769.png) 本题力扣上没有原题,大家可以去[卡码网第46题](https://kamacoder.com/problempage.php?pid=1046)去练习,题意是一样的,代码如下: diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" index be7a5d54f9..7dd78302ee 100644 --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\345\256\214\345\205\250\350\203\214\345\214\205\344\270\200\347\273\264.md" @@ -54,11 +54,11 @@ for (int i = 1; i < n; i++) { // 遍历物品 遍历物品在外层循环,遍历背包容量在内层循环,状态如图: -![动态规划-完全背包1](https://file.kamacoder.com/pics/20210126104529605.jpg) +![动态规划-完全背包1](https://file1.kamacoder.com/i/algo/20210126104529605.jpg) 遍历背包容量在外层循环,遍历物品在内层循环,状态如图: -![动态规划-完全背包2](https://file.kamacoder.com/pics/20210729234011.png) +![动态规划-完全背包2](https://file1.kamacoder.com/i/algo/20210729234011.png) 看了这两个图,大家就会理解,完全背包中,两个for循环的先后循序,都不影响计算dp[j]所需要的值(这个值就是下标j之前所对应的dp[j])。 diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\244\232\351\207\215\350\203\214\345\214\205.md" old mode 100644 new mode 100755 diff --git "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" old mode 100644 new mode 100755 index cb8db1e0e3..02b3cdc32d --- "a/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" +++ "b/problems/\350\203\214\345\214\205\351\227\256\351\242\230\347\220\206\350\256\272\345\237\272\347\241\200\345\256\214\345\205\250\350\203\214\345\214\205.md" @@ -66,7 +66,7 @@ 推导方向如图: -![](https://file.kamacoder.com/pics/20241126112952.png) +![](https://file1.kamacoder.com/i/algo/20241126112952.png) 如果放物品1, **那么背包要先留出物品1的容量**,目前容量是4,物品1 的容量(就是物品1的重量)为3,此时背包剩下容量为1。 @@ -78,7 +78,7 @@ 所以 放物品1 的情况 = dp[1][1] + 物品1 的价值,推导方向如图: -![](https://file.kamacoder.com/pics/20241126113104.png) +![](https://file1.kamacoder.com/i/algo/20241126113104.png) (**注意上图和 [01背包理论基础(二维数组)](https://programmercarl.com/背包理论基础01背包-1.html) 中的区别**,对于理解完全背包很重要) @@ -103,7 +103,7 @@ 首先从dp[i][j]的定义出发,如果背包容量j为0的话,即dp[i][0],无论是选取哪些物品,背包价值总和一定为0。如图: -![动态规划-背包问题2](https://file.kamacoder.com/pics/2021011010304192.png) +![动态规划-背包问题2](https://file1.kamacoder.com/i/algo/2021011010304192.png) 在看其他情况。 @@ -132,7 +132,7 @@ for (int j = weight[0]; j <= bagWeight; j++) 此时dp数组初始化情况如图所示: -![](https://file.kamacoder.com/pics/20241114161608.png) +![](https://file1.kamacoder.com/i/algo/20241114161608.png) dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化多少呢? @@ -185,7 +185,7 @@ for(int j = 0; j <= bagWeight; j++) { // 遍历背包容量 以本篇举例数据为例,填满了dp二维数组如图: -![](https://file.kamacoder.com/pics/20241126113752.png) +![](https://file1.kamacoder.com/i/algo/20241126113752.png) 因为 物品0 的性价比是最高的,而且 在完全背包中,每一类物品都有无限个,所以有无限个物品0,既然物品0 性价比最高,当然是优先放物品0。 diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index 4c67fb401a..7aff85764e --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\346\200\273\347\273\223\347\257\207.md" @@ -128,7 +128,7 @@ Carl个人认为:如果找出局部最优并可以推出全局最优,就是 贪心专题汇聚为一张图: -![](https://file.kamacoder.com/pics/贪心总结water.png) +![](https://file1.kamacoder.com/i/algo/贪心总结water.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412)所画,总结的非常好,分享给大家。 diff --git "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 2d0af8791a..3bcf307525 --- "a/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\350\264\252\345\277\203\347\256\227\346\263\225\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -7,7 +7,7 @@ 题目分类大纲如下: -贪心算法大纲 +贪心算法大纲 ## 算法公开课 diff --git "a/problems/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" "b/problems/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" new file mode 100755 index 0000000000..98aa47a865 --- /dev/null +++ "b/problems/\351\200\222\345\275\222\347\256\227\346\263\225\347\232\204\346\227\266\351\227\264\344\270\216\347\251\272\351\227\264\345\244\215\346\235\202\345\272\246\345\210\206\346\236\220.md" @@ -0,0 +1,281 @@ +* [做项目(多个C++、Java、Go、测开、前端项目)](./other/kstar.md) +* [刷算法(两个月高强度学算法)](./xunlian/xunlianying.md) +* [背八股(40天挑战高频面试题)](./xunlian/bagu.md) + + + + + + + + + + + + + + +# 递归算法的时间与空间复杂度分析! + +之前在[通过一道面试题目,讲一讲递归算法的时间复杂度!](https://programmercarl.com/前序/通过一道面试题目,讲一讲递归算法的时间复杂度!.html)中详细讲解了递归算法的时间复杂度,但没有讲空间复杂度。 + +本篇讲通过求斐波那契数列和二分法再来深入分析一波递归算法的时间和空间复杂度,细心看完,会刷新对递归的认知! + + +## 递归求斐波那契数列的性能分析 + +先来看一下求斐波那契数的递归写法。 + +```CPP +int fibonacci(int i) { + if(i <= 0) return 0; + if(i == 1) return 1; + return fibonacci(i-1) + fibonacci(i-2); +} +``` + +对于递归算法来说,代码一般都比较简短,从算法逻辑上看,所用的存储空间也非常少,但运行时需要内存可不见得会少。 + +### 时间复杂度分析 + +来看看这个求斐波那契的递归算法的时间复杂度是多少呢? + +在讲解递归时间复杂度的时候,我们提到了递归算法的时间复杂度本质上是要看: **递归的次数 * 每次递归的时间复杂度**。 + +可以看出上面的代码每次递归都是O(1)的操作。再来看递归了多少次,这里将i为5作为输入的递归过程 抽象成一棵递归树,如图: + + +![递归空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305093200104.png) + +从图中,可以看出f(5)是由f(4)和f(3)相加而来,那么f(4)是由f(3)和f(2)相加而来 以此类推。 + +在这棵二叉树中每一个节点都是一次递归,那么这棵树有多少个节点呢? + +我们之前也有说到,一棵深度(按根节点深度为1)为k的二叉树最多可以有 2^k - 1 个节点。 + +所以该递归算法的时间复杂度为O(2^n),这个复杂度是非常大的,随着n的增大,耗时是指数上升的。 + +来做一个实验,大家可以有一个直观的感受。 + +以下为C++代码,来测一下,让我们输入n的时候,这段递归求斐波那契代码的耗时。 + +```CPP +#include +#include +#include +using namespace std; +using namespace chrono; +int fibonacci(int i) { + if(i <= 0) return 0; + if(i == 1) return 1; + return fibonacci(i - 1) + fibonacci(i - 2); +} +void time_consumption() { + int n; + while (cin >> n) { + milliseconds start_time = duration_cast( + system_clock::now().time_since_epoch() + ); + + fibonacci(n); + + milliseconds end_time = duration_cast( + system_clock::now().time_since_epoch() + ); + cout << milliseconds(end_time).count() - milliseconds(start_time).count() + <<" ms"<< endl; + } +} +int main() +{ + time_consumption(); + return 0; +} +``` + +根据以上代码,给出几组实验数据: + +测试电脑以2015版MacPro为例,CPU配置:`2.7 GHz Dual-Core Intel Core i5` + +测试数据如下: + +* n = 40,耗时:837 ms +* n = 50,耗时:110306 ms + +可以看出,O(2^n)这种指数级别的复杂度是非常大的。 + +所以这种求斐波那契数的算法看似简洁,其实时间复杂度非常高,一般不推荐这样来实现斐波那契。 + +其实罪魁祸首就是这里的两次递归,导致了时间复杂度以指数上升。 + +```CPP +return fibonacci(i-1) + fibonacci(i-2); +``` + +可不可以优化一下这个递归算法呢。 主要是减少递归的调用次数。 + +来看一下如下代码: + +```CPP +// 版本二 +int fibonacci(int first, int second, int n) { + if (n <= 0) { + return 0; + } + if (n < 3) { + return 1; + } + else if (n == 3) { + return first + second; + } + else { + return fibonacci(second, first + second, n - 1); + } +} +``` + +这里相当于用first和second来记录当前相加的两个数值,此时就不用两次递归了。 + +因为每次递归的时候n减1,即只是递归了n次,所以时间复杂度是 O(n)。 + +同理递归的深度依然是n,每次递归所需的空间也是常数,所以空间复杂度依然是O(n)。 + +代码(版本二)的复杂度如下: + +* 时间复杂度:O(n) +* 空间复杂度:O(n) + +此时再来测一下耗时情况验证一下: + +```CPP +#include +#include +#include +using namespace std; +using namespace chrono; +int fibonacci_3(int first, int second, int n) { + if (n <= 0) { + return 0; + } + if (n < 3) { + return 1; + } + else if (n == 3) { + return first + second; + } + else { + return fibonacci_3(second, first + second, n - 1); + } +} + +void time_consumption() { + int n; + while (cin >> n) { + milliseconds start_time = duration_cast( + system_clock::now().time_since_epoch() + ); + + fibonacci_3(1, 1, n); + + milliseconds end_time = duration_cast( + system_clock::now().time_since_epoch() + ); + cout << milliseconds(end_time).count() - milliseconds(start_time).count() + <<" ms"<< endl; + } +} +int main() +{ + time_consumption(); + return 0; +} + +``` + +测试数据如下: + +* n = 40,耗时:0 ms +* n = 50,耗时:0 ms + +大家此时应该可以看出差距了!! + +### 空间复杂度分析 + +说完了这段递归代码的时间复杂度,再看看如何求其空间复杂度呢,这里给大家提供一个公式:**递归算法的空间复杂度 = 每次递归的空间复杂度 * 递归深度** + +为什么要求递归的深度呢? + +因为每次递归所需的空间都被压到调用栈里(这是内存管理里面的数据结构,和算法里的栈原理是一样的),一次递归结束,这个栈就是就是把本次递归的数据弹出去。所以这个栈最大的长度就是递归的深度。 + +此时可以分析这段递归的空间复杂度,从代码中可以看出每次递归所需要的空间大小都是一样的,所以每次递归中需要的空间是一个常量,并不会随着n的变化而变化,每次递归的空间复杂度就是$O(1)$。 + +在看递归的深度是多少呢?如图所示: + + +![递归空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305094749554.png) + +递归第n个斐波那契数的话,递归调用栈的深度就是n。 + +那么每次递归的空间复杂度是O(1), 调用栈深度为n,所以这段递归代码的空间复杂度就是O(n)。 + +```CPP +int fibonacci(int i) { + if(i <= 0) return 0; + if(i == 1) return 1; + return fibonacci(i-1) + fibonacci(i-2); +} +``` + + +最后对各种求斐波那契数列方法的性能做一下分析,如题: + + +![递归的空间复杂度分析](https://file1.kamacoder.com/i/algo/20210305095227356.png) + +可以看出,求斐波那契数的时候,使用递归算法并不一定是在性能上是最优的,但递归确实简化的代码层面的复杂度。 + +### 二分法(递归实现)的性能分析 + +带大家再分析一段二分查找的递归实现。 + +```CPP +int binary_search( int arr[], int l, int r, int x) { + if (r >= l) { + int mid = l + (r - l) / 2; + if (arr[mid] == x) + return mid; + if (arr[mid] > x) + return binary_search(arr, l, mid - 1, x); + return binary_search(arr, mid + 1, r, x); + } + return -1; +} +``` + +都知道二分查找的时间复杂度是O(logn),那么递归二分查找的空间复杂度是多少呢? + +我们依然看 **每次递归的空间复杂度和递归的深度** + +每次递归的空间复杂度可以看出主要就是参数里传入的这个arr数组,但需要注意的是在C/C++中函数传递数组参数,不是整个数组拷贝一份传入函数而是传入的数组首元素地址。 + +**也就是说每一层递归都是公用一块数组地址空间的**,所以 每次递归的空间复杂度是常数即:O(1)。 + +再来看递归的深度,二分查找的递归深度是logn ,递归深度就是调用栈的长度,那么这段代码的空间复杂度为 1 * logn = O(logn)。 + +大家要注意自己所用的语言在传递函数参数的时,是拷贝整个数值还是拷贝地址,如果是拷贝整个数值那么该二分法的空间复杂度就是O(nlogn)。 + + +## 总结 + +本章我们详细分析了递归实现的求斐波那契和二分法的空间复杂度,同时也对时间复杂度做了分析。 + +特别是两种递归实现的求斐波那契数列,其时间复杂度截然不容,我们还做了实验,验证了时间复杂度为O(2^n)是非常耗时的。 + +通过本篇大家应该对递归算法的时间复杂度和空间复杂度有更加深刻的理解了。 + + + + + + + diff --git "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" old mode 100644 new mode 100755 index 99bb2abcd0..df1747e26a --- "a/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" +++ "b/problems/\351\223\276\350\241\250\346\200\273\347\273\223\347\257\207.md" @@ -75,7 +75,7 @@ ## 总结 -![](https://file.kamacoder.com/pics/链表总结.png) +![](https://file1.kamacoder.com/i/algo/链表总结.png) 这个图是 [代码随想录知识星球](https://programmercarl.com/other/kstar.html) 成员:[海螺人](https://wx.zsxq.com/dweb2/index/footprint/844412858822412),所画,总结的非常好,分享给大家。 diff --git "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" old mode 100644 new mode 100755 index 5305c9a9dc..c465818739 --- "a/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" +++ "b/problems/\351\223\276\350\241\250\347\220\206\350\256\272\345\237\272\347\241\200.md" @@ -12,7 +12,7 @@ 链表的入口节点称为链表的头结点也就是head。 如图所示: -![链表1](https://file.kamacoder.com/pics/20200806194529815.png) +![链表1](https://file1.kamacoder.com/i/algo/20200806194529815.png) ## 链表的类型 @@ -31,7 +31,7 @@ 双链表 既可以向前查询也可以向后查询。 如图所示: -![链表2](https://file.kamacoder.com/pics/20200806194559317.png) +![链表2](https://file1.kamacoder.com/i/algo/20200806194559317.png) ### 循环链表 @@ -39,7 +39,7 @@ 循环链表可以用来解决约瑟夫环问题。 -![链表4](https://file.kamacoder.com/pics/20200806194629603.png) +![链表4](https://file1.kamacoder.com/i/algo/20200806194629603.png) ## 链表的存储方式 @@ -54,7 +54,7 @@ 如图所示: -![链表3](https://file.kamacoder.com/pics/20200806194613920.png) +![链表3](https://file1.kamacoder.com/i/algo/20200806194613920.png) 这个链表起始节点为2, 终止节点为7, 各个节点分布在内存的不同地址空间上,通过指针串联在一起。 @@ -104,7 +104,7 @@ head->val = 5; 删除D节点,如图所示: -![链表-删除节点](https://file.kamacoder.com/pics/20200806195114541-20230310121459257.png) +![链表-删除节点](https://file1.kamacoder.com/i/algo/20200806195114541-20230310121459257.png) 只要将C节点的next指针 指向E节点就可以了。 @@ -118,7 +118,7 @@ head->val = 5; 如图所示: -![链表-添加节点](https://file.kamacoder.com/pics/20200806195134331-20230310121503147.png) +![链表-添加节点](https://file1.kamacoder.com/i/algo/20200806195134331-20230310121503147.png) 可以看出链表的增添和删除都是O(1)操作,也不会影响到其他节点。 @@ -128,7 +128,7 @@ head->val = 5; 再把链表的特性和数组的特性进行一个对比,如图所示: -![链表-链表与数据性能对比](https://file.kamacoder.com/pics/20200806195200276.png) +![链表-链表与数据性能对比](https://file1.kamacoder.com/i/algo/20200806195200276.png) 数组在定义的时候,长度就是固定的,如果想改动数组的长度,就需要重新定义一个新的数组。 diff --git "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" old mode 100644 new mode 100755 index 0207b71eac..7e23172093 --- "a/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" +++ "b/problems/\351\235\242\350\257\225\351\242\23002.07.\351\223\276\350\241\250\347\233\270\344\272\244.md" @@ -13,7 +13,7 @@ 图示两个链表在节点 c1 开始相交: -![](https://file.kamacoder.com/pics/20211219221657.png) +![](https://file1.kamacoder.com/i/algo/20211219221657.png) 题目数据 保证 整个链式结构中不存在环。 @@ -21,15 +21,15 @@ 示例 1: -![](https://file.kamacoder.com/pics/20211219221723.png) +![](https://file1.kamacoder.com/i/algo/20211219221723.png) 示例 2: -![](https://file.kamacoder.com/pics/20211219221749.png) +![](https://file1.kamacoder.com/i/algo/20211219221749.png) 示例 3: -![](https://file.kamacoder.com/pics/20211219221812.png) +![](https://file1.kamacoder.com/i/algo/20211219221812.png) @@ -42,11 +42,11 @@ 看如下两个链表,目前curA指向链表A的头结点,curB指向链表B的头结点: -![面试题02.07.链表相交_1](https://code-thinking.cdn.bcebos.com/pics/面试题02.07.链表相交_1.png) +![面试题02.07.链表相交_1](https://file1.kamacoder.com/i/algo/面试题02.07.链表相交_1.png) 我们求出两个链表的长度,并求出两个链表长度的差值,然后让curA移动到,和curB 末尾对齐的位置,如图: -![面试题02.07.链表相交_2](https://code-thinking.cdn.bcebos.com/pics/面试题02.07.链表相交_2.png) +![面试题02.07.链表相交_2](https://file1.kamacoder.com/i/algo/面试题02.07.链表相交_2.png) 此时我们就可以比较curA和curB是否相同,如果不相同,同时向后移动curA和curB,如果遇到curA == curB,则找到交点。