Merge pull request #1641 from zhywanna/patch-1

Update 0112.路径总和.md
This commit is contained in:
程序员Carl 2022-09-15 16:41:10 +08:00 committed by GitHub
commit fa66994a92
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 = [], []