0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
class Solution: left_high,right_high = None,None def maxDepth(self, root: Optional[TreeNode]) -> int: if root==None: return 0 left_high = self.maxDepth(root.left) right_high = self.maxDepth(root.right) return max(left_high,right_high) + 1
|