Binary Tree Preorder Traversal python
来源:互联网 发布:网络摄像机ip设置 编辑:程序博客网 时间:2024/05/18 02:43
Binary Tree Preorder Traversal """Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param: root: A Tree @return: Preorder in ArrayList which contains node values. """ def preorderTraversal(self, root): # write your code here if root is None: return [] arrLeft = self.preorderTraversal(root.left) arrRight = self.preorderTraversal(root.right) return [root.val] + arrLeft + arrRight
阅读全文
0 0
- Binary Tree Preorder Traversal python
- 【LeetCode with Python】 Binary Tree Preorder Traversal
- Leetcode -- Python -- Binary Tree Preorder Traversal
- leetcode [python] 【144】 Binary Tree Preorder Traversal
- 【Leetcode】【python】Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Preorder Traversal
- HDU-6187:Destroy Walls
- NYOJ 399 整除个数
- .net调用C++代码需要注意的一些问题
- 6-4 使用函数输出指定范围内的Fibonacci数
- [js高手之路]this知多少
- Binary Tree Preorder Traversal python
- *p++
- Codeforces 849B
- [机器学习实验3]Logistic Regression and Newton Method
- code diary
- 6-5 使用函数验证哥德巴赫猜想
- 51Nod 1057 N的阶乘
- eclipse连接MySQL
- HDU 5875 Function 线段树 || (ST表 + 二分)