mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 08:50:15 +08:00
add dfs function operation in the main traversal function
This commit is contained in:
@ -189,7 +189,7 @@ class Solution:
|
||||
res.append(node.val)
|
||||
dfs(node.left)
|
||||
dfs(node.right)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
|
||||
```
|
||||
@ -207,6 +207,7 @@ class Solution:
|
||||
res.append(node.val)
|
||||
dfs(node.right)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
```python
|
||||
@ -224,7 +225,7 @@ class Solution:
|
||||
dfs(node.left)
|
||||
dfs(node.right)
|
||||
res.append(node.val)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user