Count connected friend groups
Given people and the friendships between them, count the friend groups: two people are in the same group when they are friends, directly or through a chain of friends. Solve it with a graph traversal or union-find and give the time and space.
No answer yet. Write the first one; the best answer gets endorsed.
