Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 0112.路径总和.md #2889

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

WanZhan-lucky
Copy link

针对卡哥写的C++递归回溯,卡哥写的回溯有点绕,前面又return true,后面最终为return false。卡哥这个地方也没讲清楚,一笔带过了,所以我结合之前的对称二叉树,直接return leftpath || rightpath;对左右子树取或操作,更好理解,我认为

针对卡哥写的C++递归回溯,卡哥写的回溯有点绕,前面又return true,后面最终为return false。卡哥这个地方也没讲清楚,一笔带过了,所以我结合之前的对称二叉树,直接return leftpath || rightpath;对左右子树取或操作,更好理解,我认为
把递归的写法简化,卡哥写的有点绕,即使是最后精简的,
if里面又套if,中间又返回return true,最后return false,我学这道题看了蛮久,我改进了一点,感觉更好理解一些,直接return leftpath || rightpath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant