leetcode998】的更多相关文章

We are given the root node of a maximum tree: a tree where every node has a value greater than any other value in its subtree. Just as in the previous problem, the given tree was constructed from an list A (root = Construct(A)) recursively with the f…
class Solution: def __init__(self): self.prelist = list() def preTree(self,root:TreeNode): if root != None: self.preTree(root.left) self.prelist.append(root.val) self.preTree(root.right) def Construct(self,ary): if len(ary)>0: result = TreeNode(ary[0…