# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def __init__(self):
self.res = []
def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
if root:
self.inorderTraversal(root.left)
self.res.append(root.val)
self.inorderTraversal(root.right)
return self.res
相关文章
- 10-13leetcode Binary Tree Inorder Traversal python
- 10-13LeetCode:145_Binary Tree Postorder Traversal | 二叉树后序遍历 | Hard
- 10-13[LeetCode]题解(python):105-Construct Binary Tree from Preorder and Inorder Traversal
- 10-13Leetcode#145 Binary Tree Postorder Traversal
- 10-13[LeetCode145]Binary Tree Postorder Traversal
- 10-13[LeetCode] 105. Construct Binary Tree from Preorder and Inorder Traversal_Medium tag: Tree Traversal
- 10-13Binary Tree Inorder Traversal
- 10-13LeetCode Binary Tree Preorder Traversal 先根遍历
- 10-13103. Binary Tree Zigzag Level Order Traversal
- 10-13【leetcode】Binary Tree Postorder Traversal (hard) ☆