add some fun tree playing

This commit is contained in:
bt3gl 2023-07-29 14:28:17 -07:00 committed by GitHub
parent 48720ada4d
commit bb72bab679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 209 additions and 0 deletions

View file

@ -0,0 +1,6 @@
def max_depth(root: Optional[TreeNode]) -> int:
if root is None:
return 0
return max(max_depth(root.left) + 1, max_depth(root.right) + 1)