Sort by

recency

|

1353 Discussions

|

  • + 0 comments

    Simple Java Code

    class Result {
    
        /*
         * Complete the 'viralAdvertising' function below.
         *
         * The function is expected to return an INTEGER.
         * The function accepts INTEGER n as parameter.
         */
    
        public static int viralAdvertising(int n) {
        // Write your code here
            
           int total = 0;
           int recip = 5;
           
           for(int i = 1; i<= n; i++)
           {
            int div = recip / 2;
            total+=div;
            int mul = div * 3;
            recip = mul;
           }
           return total;
        }
    
    }
    
  • + 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)
    
  • + 1 comment

    Solving it in O(1) time complexity is generally not possible, since each day's values (people who liked) depend on the previous day's calculations.

  • + 1 comment

    Viral advertising is a powerful marketing strategy designed to spread a brand's message quickly and organically through social sharing. By creating engaging, memorable, and often emotion-driven content, businesses can leverage the power of social media platforms and word-of-mouth to reach a broad audience. The key to successful viral advertising lies in its ability to evoke strong reactions—whether humor, inspiration, or shock—prompting viewers to share the content with others. This approach not only boosts brand visibility but also fosters a sense of authenticity, as recommendations learn more and family are often more trusted than traditional ads.

  • + 1 comment

    Viral advertising is a marketing strategy designed to generate rapid and widespread awareness of a product, service, or idea through organic sharing among audiences. By leveraging the power of social media platforms, emails, or word-of-mouth communication, viral campaigns aim to captivate viewers with engaging, relatable, or emotionally compelling content that encourages them to share it with others. This method often relies on creative storytelling, humor, or unexpected twists to capture attention. Successful viral advertising not only boosts brand visibility but also fosters a sense of community among audiences, as they actively participate in spreading car wrap advertising the message. However, creating content that resonates broadly while aligning with brand values is crucial to ensure the campaign's positive impact.