• + 0 comments

    Here is my Python solution! Each day, the amount of likes increases by triple the previous day divided by 2. At the end, we just add all of the likes to get the total amount.

    def viralAdvertising(n):
        likes = [2]
        for a in range(n - 1):
            likes.append((likes[-1] * 3) // 2)
        return sum(likes)