MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

BFS/MaximumDepthOfBinaryTree.py:31–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30"""
31class Solution:
32
33 def maxDepth(self, root: TreeNode) -> int:
34 if root is None:
35 return 0
36 else:
37 left_height = self.maxDepth(root.left)
38 right_height = self.maxDepth(root.right)
39 return max(left_height, right_height) + 1
40

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected