AAlgoLoopSpaced repetition for LeetCode

Graph

Graph problems model entities and their connections, then ask about paths, reachability, components, or cycles. The first decision is the representation (adjacency list versus matrix); the second is which traversal — BFS, DFS, or a shortest-path algorithm — fits.

12 LeetCode problems solved with the Graph pattern. Practice them with spaced repetition so the pattern sticks.

See the full solution

The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.

Start free →