From 08169cefbc060617dd9a0b81de069c1b88a7719c Mon Sep 17 00:00:00 2001 From: zhywanna <47680024+zhywanna@users.noreply.github.com> Date: Sun, 11 Sep 2022 16:12:58 +0800 Subject: [PATCH] =?UTF-8?q?Update=200112.=E8=B7=AF=E5=BE=84=E6=80=BB?= =?UTF-8?q?=E5=92=8C.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1\ return 的位置错误 2\ 第二个traversal的输入值错误 --- problems/0112.路径总和.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/0112.路径总和.md b/problems/0112.路径总和.md index d4cb5190..c6c22e7d 100644 --- a/problems/0112.路径总和.md +++ b/problems/0112.路径总和.md @@ -499,7 +499,7 @@ class solution: if not cur_node.left and not cur_node.right: if remain == 0: result.append(path[:]) - return + return if cur_node.left: path.append(cur_node.left.val) @@ -508,7 +508,7 @@ class solution: if cur_node.right: path.append(cur_node.right.val) - traversal(cur_node.right, remain-cur_node.left.val) + traversal(cur_node.right, remain-cur_node.right.val) path.pop() result, path = [], []