Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Definition for a binary tree node.
- class TreeNode(object):
- def __init__(self, x):
- self.val = x
- self.left = None
- self.right = None
- class Solution(object):
- def inorderTraversal(self, root):
- """
- :type root: TreeNode
- :rtype: List[int]
- """
- if not root:
- return([])
- out = []
- l = self.inorderTraversal(root.left)
- if l: out += l
- out += [root.val]
- r = self.inorderTraversal(root.right)
- if r: out += r
- return(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement