interactive-coding-challenges/graphs_trees/tree_height/height.py

5 lines
133 B
Python
Raw Normal View History

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