Mutual Connections in a Social Graph
Given a graph of user connections, implement functions to find mutual friends between two users, discover second-degree connections, and determine the shortest path between any two users using BFS.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late October, 2026
Part 1 : Create an adjacency list given the graph of connections. Find mutual friends of two given users. Return output in a sorted fashion Part 2 : Optimise the output of the graph to find mutual connections. Part 3 : Find the 2nd mutual connection of a given user. Part 4: Find the shortest distance between two users, using BFS.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.