class Solution(object):
    def maxDepth(self, root):
        if not root:
            return 0
        max_l = self.maxDepth(root.left)  # 左子树的最大深度
        max_r = self.maxDepth(root.right) # 右子树的最大深度
        return max(max_l, max_r) + 1  
a22fad06402759a67d96b929d0a47a7aaeededac
<mask token>

class Solution(object):
    <mask token>

class Solution(object):

    def maxDepth(self, root):
        if not root:
            return 0
        max_l = self.maxDepth(root.left)
        max_r = self.maxDepth(root.right)
        return max(max_l, max_r) + 1

class Solution(object):
    def maxDepth(self, root):
        if not root:
            return 0
        max_l = self.maxDepth(root.left)  # 左子树的最大深度
        max_r = self.maxDepth(root.right) # 右子树的最大深度
        return max(max_l, max_r) + 1  