mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-03 02:43:26 +08:00
Merge pull request #2512 from gggxxxx/XiongGu-branch
Add dfs function execution in the tree traversal (Python)
This commit is contained in:
@@ -190,6 +190,7 @@ class Solution:
|
||||
dfs(node.left)
|
||||
dfs(node.right)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
|
||||
```
|
||||
@@ -207,6 +208,7 @@ class Solution:
|
||||
res.append(node.val)
|
||||
dfs(node.right)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
```python
|
||||
@@ -225,6 +227,7 @@ class Solution:
|
||||
dfs(node.right)
|
||||
res.append(node.val)
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user