• + 0 comments

    Python3 Simple Brute force approach.

    def viralAdvertising(n):
        Acc = 0
        Shares = 5  # Initial shares on the first day
    
        for _ in range(n):
            Likes = Shares // 2  # Calculate likes as half of the shares
            Acc += Likes  # Accumulate the total likes
            Shares = Likes * 3  # Calculate new shares based on the likes
    
        return Acc