Update 0112.路径总和.md

1\ return 的位置错误
2\ 第二个traversal的输入值错误
This commit is contained in:
zhywanna 2022-09-11 16:12:58 +08:00 committed by GitHub
parent cc5a2feda3
commit 08169cefbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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 = [], []