题解 | #二叉树的最大深度#
https://www.nowcoder.com/practice/8a2b2bf6c19b4f23a9bdb9b233eefa73
#采用递归解法
class Solution: def maxDepth(self , root: TreeNode) -> int: # write code here if root is None: return 0 left = self.maxDepth(root.left) right = self.maxDepth(root.right) count = max(left, right) + 1 return count