<filename>binary_tree_maximum_node.py<gh_stars>0
# coding: utf-8

class Solution:
    # @param {TreeNode} root the root of binary tree
    # @return {TreeNode} the max node
    def maxNode(self, root):
        if root:
            _max = root
            if root.left:
                left_max = self.maxNode(root.left)
                if _max.val < left_max.val:
                    _max = left_max
            if root.right:
                right_max = self.maxNode(root.right)
                if _max.val < right_max.val:
                    _max = right_max
            return _max

# entry: http://www.lintcode.com/zh-cn/problem/binary-tree-maximum-node/

<filename>binary_tree_maximum_node.py<gh_stars>0
# coding: utf-8

class Solution:
    # @param {TreeNode} root the root of binary tree
    # @return {TreeNode} the max node
    def maxNode(self, root):
        if root:
            _max = root
            if root.left:
                left_max = self.maxNode(root.left)
                if _max.val < left_max.val:
                    _max = left_max
            if root.right:
                right_max = self.maxNode(root.right)
                if _max.val < right_max.val:
                    _max = right_max
            return _max

# entry: http://www.lintcode.com/zh-cn/problem/binary-tree-maximum-node/

# coding: utf-8 # @param {TreeNode} root the root of binary tree # @return {TreeNode} the max node # entry: http://www.lintcode.com/zh-cn/problem/binary-tree-maximum-node/