Skip to content

Latest commit

 

History

History

000014-viral-advertising

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Viral Advertising

HackerLand Enterprise is adopting a new viral advertising strategy. When they launch a new product, they advertise it to exactly 5 people on social media.

On the first day, half of those 5 people (i.e., floor(5/2) = 2) like the advertisement and each shares it with 3 of their friends. At the beginning of the second day, floor(5 / 2) * 3 = 6 people receive the advertisement.

Each day, floor(recipient/2) of the recipients like the advertisement and will share it with 3 friends on the following day. Assuming nobody receives the advertisement twice, determine how many people have liked the ad by the end of a given day, beginning with launch day as day 3.

Example 1

[in]
5

[out]
24
Day Shared Liked Cumulative
1 5 2 2
2 6 3 5
3 9 4 9
4 12 6 15
5 18 9 24

The progression is shown above. The cumulative number of likes on the 5 day is 24.