You are viewing a single comment's thread. Return to all comments →
Python
def getHeight(self, root): if not root.right and not root.left: return 0 r_h = self.getHeight(root.right) if root.right else 0 r_l = self.getHeight(root.left) if root.left else 0 return max(r_h, r_l) + 1
Seems like cookies are disabled on this browser, please enable them to open this website
Day 22: Binary Search Trees
You are viewing a single comment's thread. Return to all comments →
Python