3min,一次过
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root:return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1
3min,一次过
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root:return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1