• + 0 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