</>OfferRetriever
DashboardDiscuss
NEW

July 4th Sale

Limited Time Deal: Unlock all premium questions for over 40% off

$10.42$6.25

10

:

09

:

27

:

54

Get this deal
Back to Dashboard

Employee Referral Program

Medium

A company runs a referral program where employees can refer new hires. When employee A refers employee B, A receives credit not only for B but also for everyone B subsequently refers, and so on transitively.

Given two parallel lists -- referrers and referrals -- where referrers[i] referred referrals[i], compute the total referral credit for each person who made at least one referral. Return the top 3 referrers sorted by credit count in descending order. If two referrers have the same count, sort them alphabetically. Format each entry as "Name count". ...