Merge pull request #10 from weijiew/patch-1

Update 0112.路径总和.md
This commit is contained in:
Carl Sun
2021-05-05 10:14:47 +08:00
committed by GitHub

View File

@ -249,7 +249,7 @@ private:
vector<int> path; vector<int> path;
// 递归函数不需要返回值,因为我们要遍历整个树 // 递归函数不需要返回值,因为我们要遍历整个树
void traversal(TreeNode* cur, int count) { void traversal(TreeNode* cur, int count) {
if (!cur->left && !cur->right && count == 0) { // 遇到了叶子节点找到了和为sum的路径 if (!cur->left && !cur->right && count == 0) { // 遇到了叶子节点找到了和为sum的路径
result.push_back(path); result.push_back(path);
return; return;
} }