• + 0 comments

    Solution with recursion

    def viralAdvertising(n): def rec(n, r): if n == 1: return r return r + rec(n-1, r*3//2)

    return rec(n, 2)