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

Method maxDepth

BFS/MaximumDepthOfBinaryTree.py:33–39  ·  view source on GitHub ↗
(self, root: TreeNode)

Source from the content-addressed store, hash-verified

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