Update 二叉树中递归带着回溯.md

This commit is contained in:
db
2021-12-27 09:27:45 +08:00
committed by GitHub
parent a00146c559
commit 4545e48a90

View File

@ -90,8 +90,7 @@ public:
如下为精简之后的递归代码:(257. 二叉树的所有路径) 如下为精简之后的递归代码:(257. 二叉树的所有路径)
CPP ```CPP
```
class Solution { class Solution {
private: private:
void traversal(TreeNode* cur, string path, vector<string>& result) { void traversal(TreeNode* cur, string path, vector<string>& result) {
@ -132,8 +131,7 @@ traversal(cur->left, path, result); // 左
即: 即:
``` ``` CPP
if (cur->left) { if (cur->left) {
path += "->"; path += "->";
traversal(cur->left, path, result); // 左 traversal(cur->left, path, result); // 左