We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
Most graph interview problems are BFS or DFS wearing a costume; the skill being tested is usually recognising that a grid, a set of prerequisites, or a list of flights is a graph at all. Build the adjacency list first, then pick the traversal that matches the question. Weighted shortest paths and cycle detection are the two places you need a named algorithm rather than a plain traversal.
Explicit edges, a grid treated as a graph, or dependencies between items.
27 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.