Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
48
:
59
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".
...