用python要比C++简单,因为截取数组方便,且最后在索引不对时直接返回None,然后返回空恰好又是没有左子树或者说右子树的情况。 # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # 返回构造的TreeNode根节点 def reConstructBinaryTree(self, pre, tin): # write code here if not pre: retur...