• + 0 comments
    function viralAdvertising(n) {
        let shared = 5; 
        let ans = 0; 
        for(let i = 1; i <= n; i++) {
            let liked = Math.floor(shared / 2);
            ans += liked; 
            shared = liked * 3; 
        }
        return ans; 
    }