12345678910 |
- from typing import Optional, List
- from tree import TreeNode
- class Solution:
- def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
- if root == None:
- return []
- left = self.inorderTraversal(root.left)
- right = self.inorderTraversal(root.right)
- return left + [root.val] + right
|