You are viewing a single comment's thread. Return to all comments →
PYTHON solution
def height(root): left_h, right_h = 0, 0 if root.left: left_h = 1 + height(root.left) if root.right: right_h = 1 + height(root.right) return max(left_h, right_h)
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Height of a Binary Tree
You are viewing a single comment's thread. Return to all comments →
PYTHON solution