mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-13 14:10:38 +08:00
Merge pull request #2512 from gggxxxx/XiongGu-branch
Add dfs function execution in the tree traversal (Python)
This commit is contained in:
@ -189,7 +189,8 @@ class Solution:
|
||||
res.append(node.val)
|
||||
dfs(node.left)
|
||||
dfs(node.right)
|
||||
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
|
||||
```
|
||||
@ -206,7 +207,8 @@ class Solution:
|
||||
dfs(node.left)
|
||||
res.append(node.val)
|
||||
dfs(node.right)
|
||||
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
```python
|
||||
@ -224,7 +226,8 @@ class Solution:
|
||||
dfs(node.left)
|
||||
dfs(node.right)
|
||||
res.append(node.val)
|
||||
|
||||
|
||||
dfs(root)
|
||||
return res
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user