Created
April 1, 2022 16:02
-
-
Save ThomasHigginson/21a143c74d0f74fe79018dd3539758fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def maxDepth(self, root: Optional[TreeNode]) -> int: | |
if not root: # Base case | |
return 0 | |
return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment