Degrees of Separation
Pinterest interview questions · Medium · Coding round · 6 tests
A social network has n members, labelled with the integers 0 through
n - 1. Friendships are undirected and listed as pairs [a, b]; each pair
says that a and b are friends with each other.
We define the degree of separation of two members as the fewest friendship links you must follow to travel from the first member to the second.
Interface
Run your code with Ctrl+Enter to see results.