Saved tree height challenge solution so it can be reused as a component to other related challenges.

This commit is contained in:
Donne Martin
2015-08-05 18:15:03 -04:00
parent b109b6f8cc
commit d098e67ffd
2 changed files with 28 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
def height(node):
if node is None:
return 0
return 1 + max(height(node.left),
height(node.right))