Skip to content

Graph problems,
and the tell.

Things are connected to other things and the question is about reachability, order, or distance. 85 problems in the catalogue carry this tag, from first-week easy to interview hard.

Free to start. Running and submitting a solution never costs credits.

How the pattern actually works.

One mechanism, and the mistake that costs people the problem.

The tell. Things are connected to other things and the question is about reachability, order, or distance.

The mechanism. Build an adjacency list first, then pick the walk: BFS for fewest steps, DFS for whole components, Dijkstra for weights, topological sort for dependencies.

What goes wrong. Building the graph wrong. Directed when it should be undirected, or missing the reverse edge, and every algorithm after that is correct on the wrong input.

The ones asked most often.

By how often the catalogue records them being set, not by our opinion.

  1. Number of Connected Components in an Undirected GraphMediumasked at 3 companies
  2. Maximum XOR of Two Non-Overlapping SubtreesHardasked at 2 companies
  3. Minimum Cost to Buy ApplesMediumasked at 2 companies
  4. Satisfiability of Equality EquationsMediumasked at 2 companies
  5. Count Visited Nodes in a Directed GraphHardasked at 1 companies
  6. Detonate the Maximum BombsMediumasked at 1 companies
  7. Minimum Cost to Make at Least One Valid Path in a GridHardasked at 1 companies
  8. Minimum Time to Break Locks IIHardasked at 1 companies
  9. Longest Cycle in a GraphHardasked at 1 companies
  10. Reachable Nodes With RestrictionsMediumasked at 1 companies

Read it, watch it, then solve it.

The order that makes a pattern stick.

Everything in the app, in one place.

Practice, interviews and the tools, all free to start. Swipe to see the rest.

Free to start: 100 AI credits when you sign up and 100 every month. Start free in the app

About graph problems.

Free to start, no card.

Start practising
How do I know a problem is a graph problem?

Things are connected to other things and the question is about reachability, order, or distance.

How many graph problems should I solve?

Enough to stop needing the hint, which is usually ten to fifteen across the levels, not the whole list. The catalogue tags 85, split roughly 1 easy, 45 medium and 39 hard in the sample we show, so work up rather than across.

What goes wrong most often in graph problems?

Building the graph wrong. Directed when it should be undirected, or missing the reverse edge, and every algorithm after that is correct on the wrong input.

Is practising by pattern better than a problem sheet?

A sheet tells you what to solve. A pattern tells you why those problems sit together, which is the part that carries over to the problem you have not seen. That is why the app files every problem under its pattern.