You are viewing a single comment's thread. Return to all comments →
heightnew = 0 def height(node): if node is None: return 0 return max(height(node.left), height(node.right)) +1
is this a right approach??
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 →
heightnew = 0 def height(node): if node is None: return 0 return max(height(node.left), height(node.right)) +1