• + 1 comment
    def utopianTree(n):
        k = n // 2
        return ((n % 2) + 1) *  (2 ** (k + 1) - 1)
    

    Clean python solution