mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Merge pull request #964 from IcePigZDB/diGuiWithRecall
二叉树中递归带着回溯 格式化CPP代码显示
This commit is contained in:
@ -90,7 +90,7 @@ public:
|
||||
|
||||
|
||||
如下为精简之后的递归代码:(257. 二叉树的所有路径)
|
||||
```
|
||||
```CPP
|
||||
class Solution {
|
||||
private:
|
||||
void traversal(TreeNode* cur, string path, vector<string>& result) {
|
||||
@ -131,8 +131,7 @@ traversal(cur->left, path, result); // 左
|
||||
|
||||
即:
|
||||
|
||||
```
|
||||
|
||||
``` CPP
|
||||
if (cur->left) {
|
||||
path += "->";
|
||||
traversal(cur->left, path, result); // 左
|
||||
|
Reference in New Issue
Block a user