# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None
#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param root TreeNode类 
# @return int整型一维数组
#
class Solution:
    def inorderTraversal(self , root: TreeNode) -> List[int]:
        # write code here
        if not root:
            return []
        
        # 中序遍历:左根右。
        # 递归遍历左子树。
        current_left = self.inorderTraversal(root.left)
        # 读取当前根节点的值。
        current_root = [root.val]
        # 递归遍历右子树。
        current_right = self.inorderTraversal(root.right)

        # python中可以用‘+’来合并多个列表。
        return current_left + current_root + current_right