Update bt_height.py

This commit is contained in:
bt3gl 2023-08-08 13:44:00 -07:00 committed by GitHub
parent 91cd6134b6
commit a78436b51b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,9 @@
# author: bt3gl # author: bt3gl
def height(root): def height(root):
if not root: if not root:
return -1 return 0
return 1 + max(height(root.left), height(root.right)) return 1 + max(height(root.left), height(root.right))