Tree: Height of a Binary Tree

  • + 0 comments
    def height(root, prev=0):
        return max(height(root.left), height(root.right))+1 if root is not None and (root.left is not None or root.right is not None) else prev
    `