my Python solution


  • 0
    B

    class Solution(object):
    def maxDepth(self, root):
    """
    :type root: TreeNode
    :rtype: int
    """
    if root is None:
    return 0
    lHigh = 1+ self.maxDepth(root.left)
    rHigh = 1+ self.maxDepth(root.right)
    return lHigh if lHigh > rHigh else rHigh


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.