MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / maxDepth

Method maxDepth

Python/maximum-depth-of-binary-tree.py:13–17  ·  view source on GitHub ↗
(self, root: TreeNode)

Source from the content-addressed store, hash-verified

11# self.right = right
12class Solution:
13 def maxDepth(self, root: TreeNode) -> int:
14 if root is None:
15 return 0
16 else:
17 return max(self.maxDepth(root.left)+1, self.maxDepth(root.right)+1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected