class TreeNode:
def __init__(self, x):
self.vla = x
self.left = None
self.right = None
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
reurn max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1
二叉树的最大深度为左右子树的最大深度加一
深度优先遍历