Facebook | Minimum number of people to spread a message

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2015-11-11Added By Anonymous
Source: Link

Company: Meta
Role: e3, e4
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Considering that I'd like to spread a promotion message across all people in twitter. Assuming the ideal case, if a person tweets a message, then every follower will re-tweet the message.

You need to find the minimum number of people to reach out (for example, who doesn't follow anyone etc) so that your promotion message is spread out across entire network in twitter.

Also, we need to consider loops like, if A follows B, B follows C, C follows D, D follows A (A -> B -> C -> D -> A) then reaching only one of them is sufficient to spread your message.

Input: A 2x2 matrix like below. In this case, a follows b, b follows c, c follows a.

        a b c
    a  1 1 0
    b  0 1 1
    c  1 0 1

Output: List of people to be reached to spread out message across everyone in the network.

Comments