Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 467 Bytes

binary-tree-inorder-traversal.md

File metadata and controls

19 lines (17 loc) · 467 Bytes

Binary Tree Inorder Traversal

# Definition for a  binary tree node
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    # @param root, a tree node
    # @return a list of integers
    def inorderTraversal(self, root):
        if root is None:
            return []
        return self.inorderTraversal(root.left) + [root.val] + self.inorderTraversal(root.right)