❤leetcode,python2❤二叉树的最大深度

134 阅读1分钟
class Solution(object):
    def maxDepth(self, root):
        """
        :type root: TreeNode
        :rtype: int
        """
        if root == None:
            return 0
        else:
            return 1+max(self.maxDepth(root.left),self.maxDepth(root.right))