You are viewing a single comment's thread. Return to all comments →
PHP based solution.
function viralAdvertising($n) { $likedBy = 2; $cumulative = 2; for ($i = 2; $i <= $n; $i++) { $sharedWith = $likedBy * 3; $likedBy = floor($sharedWith / 2); $cumulative = $cumulative + $likedBy; } return $cumulative; }
Seems like cookies are disabled on this browser, please enable them to open this website
Viral Advertising
You are viewing a single comment's thread. Return to all comments →
PHP based solution.