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

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