• + 1 comment

    Python Solution:

    def viralAdvertising(n):
        people = 5
        liked = (people // 2)
        shared = liked * 3
        total = liked
        
        for _ in range(n - 1):
            liked = shared // 2
            shared = liked * 3
            total += liked
        
        return total