Airbnb | Phone Screen | Cheapest way to be friends
Anonymous User
1862

Given a dictionary of friends like
0 is friends with 1,2,3
1 is friends with 4,5
3 is friends with 6,7,8,9
5 is friends with 1,2,9

What is the cheapest way for 0 to be friends with 9? Note that every introduction has a cost.
The cost is defined as (for path 0-5-9)= > (5-0) + (9-5) = 9

Comments (7)