From eb75312e199aa9fa2a1c4f0212e2bcafd6676ddf Mon Sep 17 00:00:00 2001 From: guyinfei Date: Tue, 8 Aug 2023 16:02:54 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=200027.=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=85=83=E7=B4=A0=20JAVA=E7=89=88=E6=9C=AC=20?= =?UTF-8?q?=E7=9B=B8=E5=90=91=E5=8F=8C=E6=8C=87=E9=92=88=E6=B3=95=EF=BC=88?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BA=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0027.移除元素.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/problems/0027.移除元素.md b/problems/0027.移除元素.md index 40ee3a2e..1138ffd4 100644 --- a/problems/0027.移除元素.md +++ b/problems/0027.移除元素.md @@ -197,6 +197,26 @@ class Solution { } ``` +```java +// 相向双指针法(版本二) +class Solution { + public int removeElement(int[] nums, int val) { + int left = 0; + int right = nums.length - 1; + while(left <= right){ + if(nums[left] == val){ + nums[left] = nums[right]; + right--; + }else { + // 这里兼容了right指针指向的值与val相等的情况 + left++; + } + } + return left; + } +} +``` + ### Python: From 5117a288422612c5e4a845d7ecdecff8448334d0 Mon Sep 17 00:00:00 2001 From: Bird Date: Thu, 28 Sep 2023 22:08:12 +0800 Subject: [PATCH 02/13] =?UTF-8?q?feat(0213=20=E6=89=93=E5=AE=B6=E5=8A=AB?= =?UTF-8?q?=E8=88=8D=E2=85=A1):=20=E4=BD=BFGo=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E7=AC=A6=E5=90=88Go=E4=B9=A0=E6=83=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0213.打家劫舍II.md | 44 +++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/problems/0213.打家劫舍II.md b/problems/0213.打家劫舍II.md index cd9d596d..385c5867 100644 --- a/problems/0213.打家劫舍II.md +++ b/problems/0213.打家劫舍II.md @@ -225,32 +225,38 @@ class Solution: // 打家劫舍Ⅱ 动态规划 // 时间复杂度O(n) 空间复杂度O(n) func rob(nums []int) int { - if len(nums) == 1 { - return nums[0] + // 如果长度为0或1,那么有没有环的限制都一样 + if len(nums) <= 1 { + return robWithoutCircle(nums) } - if len(nums) == 2 { - return max(nums[0], nums[1]) - } - - result1 := robRange(nums, 0) - result2 := robRange(nums, 1) - return max(result1, result2) + + // 否则,去头或去尾,取最大 + res1 := robWithoutCircle(nums[:len(nums)-1]) + res2 := robWithoutCircle(nums[1:]) + + return max(res1, res2) } -// 偷盗指定的范围 -func robRange(nums []int, start int) int { +// 原始的打家劫舍版 +func robWithoutCircle(nums []int) int { + switch len(nums) { + case 0: return 0 + case 1: return nums[0] + } dp := make([]int, len(nums)) - dp[1] = nums[start] - - for i := 2; i < len(nums); i++ { - dp[i] = max(dp[i - 2] + nums[i - 1 + start], dp[i - 1]) + dp[0]=nums[0] + dp[1] = max(nums[0], nums[1]) + + for i:=2; i b { +func max(a, b int ) int { + if a>b { return a } return b From 546d3b601a2be997855a0d9da2c5af567ebbfaa5 Mon Sep 17 00:00:00 2001 From: Bird Date: Thu, 28 Sep 2023 22:13:00 +0800 Subject: [PATCH 03/13] =?UTF-8?q?feat(1356=20=E6=95=B0=E5=AD=97=E4=BA=8C?= =?UTF-8?q?=E8=BF=9B=E5=88=B61=E6=8E=92=E5=BA=8F):=20=E4=BD=BF=E7=94=A8Go?= =?UTF-8?q?=E5=86=85=E7=BD=AE=E6=8E=92=E5=BA=8F=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...据数字二进制下1的数目排序.md | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/problems/1356.根据数字二进制下1的数目排序.md b/problems/1356.根据数字二进制下1的数目排序.md index cc7a7007..c2455cf0 100644 --- a/problems/1356.根据数字二进制下1的数目排序.md +++ b/problems/1356.根据数字二进制下1的数目排序.md @@ -171,36 +171,29 @@ class Solution: ```go func sortByBits(arr []int) []int { - var tmp int - for i := 0; i < len(arr); i++ { - for j := i+1; j < len(arr); j++ { - // 冒泡排序的手法,但是排序的规则从比大小变成了比位运算1的个数 - if isCmp(arr[i], arr[j]) { - tmp = arr[i] - arr[i] = arr[j] - arr[j] = tmp - } - } + // 是否arr[i]<=arr[j] + // 先比较1的数量,后比较值本身 + cmp := func(i, j int) bool { + c1, c2 := bitCount(arr[i]), bitCount(arr[j]) + if c1 == c2 { + return arr[i] <= arr[j] + } + return c1 <= c2 } + + // 调用库函数 + // 第一个参数是待排序切片,第二个是第i位是否小于第j位的函数 + sort.Slice(arr, cmp) + return arr } -func isCmp(a, b int) bool { - bitA := bitCount(a) - bitB := bitCount(b) - if bitA == bitB { - return a > b - } else { - return bitA > bitB - } -} - -func bitCount(n int) int { - count := 0 - for n != 0 { - n &= (n-1) // 清除最低位的1 +func bitCount(num int) (count int) { + for num != 0 { + num &= num-1 // 每次运算将最右侧的1变成0 count++ } + return count } ``` From e68557e03a312f6aa99c49a7fe7701b8befaa30c Mon Sep 17 00:00:00 2001 From: w830207 <44136372+w830207@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:22:36 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E4=BF=AE=E6=AD=A30001.=E4=B8=A4=E6=95=B0?= =?UTF-8?q?=E4=B9=8B=E5=92=8Cdart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 儘量給定類型 - 使用HashMap取代不適合的List --- problems/0001.两数之和.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/problems/0001.两数之和.md b/problems/0001.两数之和.md index 4e44d0c3..1785fe5f 100644 --- a/problems/0001.两数之和.md +++ b/problems/0001.两数之和.md @@ -402,16 +402,18 @@ public class Solution { ### Dart: ```dart -List twoSum(List nums, int target) { - var tmp = []; - for (var i = 0; i < nums.length; i++) { - var rest = target - nums[i]; - if(tmp.contains(rest)){ - return [tmp.indexOf(rest), i]; - } - tmp.add(nums[i]); +import 'dart:collection'; + +List twoSum(List nums, int target) { + HashMap hashMap = HashMap(); + for (int i = 0; i < nums.length; i++) { + int rest = target - nums[i]; + if (hashMap.containsKey(rest)) { + return [hashMap[rest]!, i]; } - return [0 , 0]; + hashMap.addEntries({nums[i]: i}.entries); + } + return []; } ``` From a8366adf1cbb7a8155a67f2d6d26db9a562acb6a Mon Sep 17 00:00:00 2001 From: wngtk <100271394+wngtk@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:49:16 +0800 Subject: [PATCH 05/13] =?UTF-8?q?Update=20=E8=83=8C=E5=8C=85=E7=90=86?= =?UTF-8?q?=E8=AE=BA=E5=9F=BA=E7=A1=8001=E8=83=8C=E5=8C=85-2.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix typo --- problems/背包理论基础01背包-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/背包理论基础01背包-2.md b/problems/背包理论基础01背包-2.md index f60e261b..7827aa95 100644 --- a/problems/背包理论基础01背包-2.md +++ b/problems/背包理论基础01背包-2.md @@ -133,7 +133,7 @@ dp[1] = dp[1 - weight[0]] + value[0] = 15 所以从后往前循环,每次取得状态不会和之前取得状态重合,这样每种物品就只取一次了。 -**那么问题又来了,为什么二维dp数组历的时候不用倒序呢?** +**那么问题又来了,为什么二维dp数组遍历的时候不用倒序呢?** 因为对于二维dp,dp[i][j]都是通过上一层即dp[i - 1][j]计算而来,本层的dp[i][j]并不会被覆盖! From 9ca0d38d989f4712bf9e45bb11f7ff8d7452e037 Mon Sep 17 00:00:00 2001 From: INSSRumia <52827806+INSSRumia@users.noreply.github.com> Date: Thu, 5 Oct 2023 01:09:05 +0800 Subject: [PATCH 06/13] =?UTF-8?q?Update=200450.=E5=88=A0=E9=99=A4=E4=BA=8C?= =?UTF-8?q?=E5=8F=89=E6=90=9C=E7=B4=A2=E6=A0=91=E4=B8=AD=E7=9A=84=E8=8A=82?= =?UTF-8?q?=E7=82=B9.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加0450删除二叉搜索树中的节点 C# 版本 --- .../0450.删除二叉搜索树中的节点.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/problems/0450.删除二叉搜索树中的节点.md b/problems/0450.删除二叉搜索树中的节点.md index 18e5cb4c..13c25023 100644 --- a/problems/0450.删除二叉搜索树中的节点.md +++ b/problems/0450.删除二叉搜索树中的节点.md @@ -769,6 +769,38 @@ impl Solution { } ``` +### C# + +> 递归法: +```C# + public TreeNode DeleteNode(TreeNode root, int key) { + // 第一种情况:没找到删除的节点,遍历到空节点直接返回了 + if (root == null) return null; + if(key == root.val) { + //第二种情况:左右孩子都为空(叶子节点),直接删除节点, 返回NULL为根节点 + if(root.left == null && root.right == null) return null; + //第三种情况:其左孩子为空,右孩子不为空,删除节点,右孩子补位 ,返回右孩子为根节点 + if (root.left == null && root.right != null) return root.right; + //第四种情况:其右孩子为空,左孩子不为空,删除节点,左孩子补位,返回左孩子为根节点 + if (root.left != null && root.right == null) return root.left; + //第五种情况:左右孩子节点都不为空,则将删除节点的左子树放到删除节点的右子树的最左面节点的左孩子的位置 + // 并返回删除节点右孩子为新的根节点。 + if(root.left != null && root.right != null) { + TreeNode leftNode = root.right; // 找右子树最左面的节点 + while(leftNode.left != null) + leftNode = leftNode.left; + leftNode.left = root.left; // 把要删除的节点(root)左子树放在leftNode的左孩子的位置 + return root.right; // 返回旧root的右孩子作为新root + } + } + + if(root.val > key) root.left = DeleteNode(root.left, key); + if(root.val < key) root.right = DeleteNode(root.right, key); + + return root; + } +``` +

From 8973967dd10fbea86996f9df413aa1559c1dac53 Mon Sep 17 00:00:00 2001 From: ShuangmingMa <52561813+ShuangmingMa@users.noreply.github.com> Date: Sun, 8 Oct 2023 15:05:51 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=200392.=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=AD=90=E5=BA=8F=E5=88=97.md=20Go=E4=BA=8C=E7=BB=B4D?= =?UTF-8?q?P=E6=A0=BC=E5=BC=8F=EF=BC=8C=E5=B9=B6=E5=A2=9E=E5=8A=A0Go?= =?UTF-8?q?=E4=B8=80=E7=BB=B4DP=E8=A7=A3=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改 0392.判断子序列.md Go二维DP格式,并增加Go一维DP解法 --- problems/0392.判断子序列.md | 39 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/problems/0392.判断子序列.md b/problems/0392.判断子序列.md index 12d3fa48..cb9323c8 100644 --- a/problems/0392.判断子序列.md +++ b/problems/0392.判断子序列.md @@ -240,26 +240,45 @@ function isSubsequence(s: string, t: string): boolean { ### Go: +二维DP: + ```go func isSubsequence(s string, t string) bool { - dp := make([][]int,len(s)+1) - for i:=0;i= 1; j -- { + if t[i - 1] == s[j - 1] { + dp[j] = dp[j - 1] + 1 + } + } + } + return dp[len(s)] == len(s) +} +``` + + +### Rust: ```rust impl Solution { From d9e08a1bbfda8295273d99699c77267dcde85696 Mon Sep 17 00:00:00 2001 From: ShuangmingMa <52561813+ShuangmingMa@users.noreply.github.com> Date: Sun, 8 Oct 2023 15:16:06 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=200392.=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=AD=90=E5=BA=8F=E5=88=97.md=20Go=E4=BA=8C=E7=BB=B4D?= =?UTF-8?q?P=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改 0392.判断子序列.md Go二维DP格式 --- problems/0392.判断子序列.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0392.判断子序列.md b/problems/0392.判断子序列.md index cb9323c8..f7863c94 100644 --- a/problems/0392.判断子序列.md +++ b/problems/0392.判断子序列.md @@ -250,7 +250,7 @@ func isSubsequence(s string, t string) bool { } for i := 1; i < len(dp); i ++{ for j := 1; j < len(dp[i]); j ++{ - if s[i - 1] == t[j-1] { + if s[i - 1] == t[j - 1] { dp[i][j] = dp[i - 1][j - 1] +1 }else{ dp[i][j] = dp[i][j - 1] From be11452af6c87e47243c8bb65aa86e517e1f4ab8 Mon Sep 17 00:00:00 2001 From: Logen <47022821+Logenleedev@users.noreply.github.com> Date: Sun, 8 Oct 2023 08:36:54 -0400 Subject: [PATCH 09/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0python=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0200.岛屿数量.深搜版.md | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/problems/0200.岛屿数量.深搜版.md b/problems/0200.岛屿数量.深搜版.md index c7649971..43eb66e1 100644 --- a/problems/0200.岛屿数量.深搜版.md +++ b/problems/0200.岛屿数量.深搜版.md @@ -278,6 +278,40 @@ class Solution: return result ``` +```python +# 我们用三个状态去标记每一个格子 +# 0 代表海水 +# 1 代表陆地 +# 2 代表已经访问的陆地 +class Solution: + def traversal(self, grid, i, j): + m = len(grid) + n = len(grid[0]) + + if i < 0 or j < 0 or i >= m or j >= n: + return # 越界了 + elif grid[i][j] == "2" or grid[i][j] == "0": + return + + grid[i][j] = "2" + self.traversal(grid, i - 1, j) # 往上走 + self.traversal(grid, i + 1, j) # 往下走 + self.traversal(grid, i, j - 1) # 往左走 + self.traversal(grid, i, j + 1) # 往右走 + + def numIslands(self, grid: List[List[str]]) -> int: + res = 0 + + + for i in range(len(grid)): + for j in range(len(grid[0])): + if grid[i][j] == "1": + res += 1 + self.traversal(grid, i, j) + + return res +``` + ### JavaScript ```javascript From 4a9c5a4385d6ac0f17981ad8fa8cd77c67585345 Mon Sep 17 00:00:00 2001 From: shengwang Date: Mon, 9 Oct 2023 11:00:53 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E5=88=AB?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0024.两两交换链表中的节点.md | 4 ++-- problems/0203.移除链表元素.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/problems/0024.两两交换链表中的节点.md b/problems/0024.两两交换链表中的节点.md index c612c4b3..36f9b0cc 100644 --- a/problems/0024.两两交换链表中的节点.md +++ b/problems/0024.两两交换链表中的节点.md @@ -51,7 +51,7 @@ class Solution { public: ListNode* swapPairs(ListNode* head) { ListNode* dummyHead = new ListNode(0); // 设置一个虚拟头结点 - dummyHead->next = head; // 将虚拟头结点指向head,这样方面后面做删除操作 + dummyHead->next = head; // 将虚拟头结点指向head,这样方便后面做删除操作 ListNode* cur = dummyHead; while(cur->next != nullptr && cur->next->next != nullptr) { ListNode* tmp = cur->next; // 记录临时节点 @@ -160,7 +160,7 @@ class Solution { class Solution { public ListNode swapPairs(ListNode head) { ListNode dumyhead = new ListNode(-1); // 设置一个虚拟头结点 - dumyhead.next = head; // 将虚拟头结点指向head,这样方面后面做删除操作 + dumyhead.next = head; // 将虚拟头结点指向head,这样方便后面做删除操作 ListNode cur = dumyhead; ListNode temp; // 临时节点,保存两个节点后面的节点 ListNode firstnode; // 临时节点,保存两个节点之中的第一个节点 diff --git a/problems/0203.移除链表元素.md b/problems/0203.移除链表元素.md index c8f802a1..780f9c36 100644 --- a/problems/0203.移除链表元素.md +++ b/problems/0203.移除链表元素.md @@ -127,7 +127,7 @@ class Solution { public: ListNode* removeElements(ListNode* head, int val) { ListNode* dummyHead = new ListNode(0); // 设置一个虚拟头结点 - dummyHead->next = head; // 将虚拟头结点指向head,这样方面后面做删除操作 + dummyHead->next = head; // 将虚拟头结点指向head,这样方便后面做删除操作 ListNode* cur = dummyHead; while (cur->next != NULL) { if(cur->next->val == val) { From 7f1c040b282aed31f7c4e6d97721daa61c603c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=9A=E6=9D=B0?= <105789281+zyj1112@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:42:12 +0800 Subject: [PATCH 11/13] =?UTF-8?q?Update=200054.=E8=9E=BA=E6=97=8B=E7=9F=A9?= =?UTF-8?q?=E9=98=B5.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0054.螺旋矩阵.md | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/problems/0054.螺旋矩阵.md b/problems/0054.螺旋矩阵.md index c62eb2b1..59771a67 100644 --- a/problems/0054.螺旋矩阵.md +++ b/problems/0054.螺旋矩阵.md @@ -251,6 +251,60 @@ var spiralOrder = function(matrix) { return arr }; ``` +### Python + +```python +class Solution(object): + def spiralOrder(self, matrix): + """ + :type matrix: List[List[int]] + :rtype: List[int] + """ + if len(matrix)==0 or len(matrix[0])==0 : # 判定List是否为空 + return [] + row, col = len(matrix), len(matrix[0]) # 行数,列数 + loop = min(row, col) // 2 # 循环轮数 + stx, sty = 0, 0 # 起始x,y坐标 + i, j =0, 0 + count = 0 # 计数 + offset = 1 # 每轮减少的格子数 + result = [0]*(row*col) + while loop>0 :# 左闭右开 + i, j = stx, sty + while j < col - offset : # 从左到右 + result[count] = matrix[i][j] + count += 1 + j += 1 + while i < row - offset : # 从上到下 + result[count] = matrix[i][j] + count += 1 + i += 1 + while j>sty : # 从右到左 + result[count] = matrix[i][j] + count += 1 + j -= 1 + while i>stx : # 从下到上 + result[count] = matrix[i][j] + count += 1 + i -= 1 + stx += 1 + sty += 1 + offset += 1 + loop -= 1 + if min(row, col) % 2 == 1 : # 判定是否需要填充多出来的一行 + i = stx + if row < col : + while i < stx + col - row + 1 : + result[count] = matrix[stx][i] + count += 1 + i += 1 + else : + while i < stx + row - col + 1 : + result[count] = matrix[i][stx] + count += 1 + i += 1 + return result +``` From 4a3e9c6bbea4acbb73c6decd2693ba0aec164a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=9A=E6=9D=B0?= <105789281+zyj1112@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:11:25 +0800 Subject: [PATCH 12/13] =?UTF-8?q?Update=200054.=E8=9E=BA=E6=97=8B=E7=9F=A9?= =?UTF-8?q?=E9=98=B5.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0054.螺旋矩阵.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/0054.螺旋矩阵.md b/problems/0054.螺旋矩阵.md index 59771a67..44a7749d 100644 --- a/problems/0054.螺旋矩阵.md +++ b/problems/0054.螺旋矩阵.md @@ -260,7 +260,7 @@ class Solution(object): :type matrix: List[List[int]] :rtype: List[int] """ - if len(matrix)==0 or len(matrix[0])==0 : # 判定List是否为空 + if len(matrix) == 0 or len(matrix[0]) == 0 : # 判定List是否为空 return [] row, col = len(matrix), len(matrix[0]) # 行数,列数 loop = min(row, col) // 2 # 循环轮数 @@ -268,7 +268,7 @@ class Solution(object): i, j =0, 0 count = 0 # 计数 offset = 1 # 每轮减少的格子数 - result = [0]*(row*col) + result = [0] * (row * col) while loop>0 :# 左闭右开 i, j = stx, sty while j < col - offset : # 从左到右 From 284143192c1c2e39bb77a19dfcbebf000270ed16 Mon Sep 17 00:00:00 2001 From: HUAWEI Date: Thu, 12 Oct 2023 17:52:17 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E5=88=AB?= =?UTF-8?q?=E5=AD=97=E2=80=9C=E8=B7=AF=E5=BE=84=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0797.所有可能的路径.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0797.所有可能的路径.md b/problems/0797.所有可能的路径.md index bcce9314..05b55b5b 100644 --- a/problems/0797.所有可能的路径.md +++ b/problems/0797.所有可能的路径.md @@ -89,7 +89,7 @@ if (x == graph.size() - 1) { // 找到符合条件的一条路径 for (int i = 0; i < graph[x].size(); i++) { // 遍历节点n链接的所有节点 ``` -接下来就是将 选中的x所连接的节点,加入到 单一路劲来。 +接下来就是将 选中的x所连接的节点,加入到 单一路径来。 ```C++ path.push_back(graph[x][i]); // 遍历到的节点加入到路径中来