class Solution:
"""
@param: root: the root of tree
@return: the max node
"""
def maxNode(self, root):
if root is None:
return None
left = right = root;
if root.left is not None:
left = self.maxNode(root.left)
if root.right is not None:
right = self.maxNode(root.right)
temp = root #因为python不支持三目运算符这里比java代码用简便的方式实现
if left.val > root.val:
temp = left
if right.val > temp.val:
temp = right
return temp