mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-10 12:15:58 +08:00
修正Markdown代码块语法
This commit is contained in:
@ -77,7 +77,7 @@ if (cur->left == NULL && cur->right == NULL) {
|
||||
|
||||
这里我们先使用vector<int>结构的path容器来记录路径,那么终止处理逻辑如下:
|
||||
|
||||
```
|
||||
```C++
|
||||
if (cur->left == NULL && cur->right == NULL) { // 遇到叶子节点
|
||||
string sPath;
|
||||
for (int i = 0; i < path.size() - 1; i++) { // 将path里记录的路径转为string格式
|
||||
@ -113,7 +113,7 @@ if (cur->right) {
|
||||
|
||||
那么回溯要怎么回溯呢,一些同学会这么写,如下:
|
||||
|
||||
```
|
||||
```C++
|
||||
if (cur->left) {
|
||||
traversal(cur->left, path, result);
|
||||
}
|
||||
@ -129,7 +129,7 @@ path.pop_back();
|
||||
|
||||
那么代码应该这么写:
|
||||
|
||||
```
|
||||
```C++
|
||||
if (cur->left) {
|
||||
traversal(cur->left, path, result);
|
||||
path.pop_back(); // 回溯
|
||||
|
Reference in New Issue
Block a user