- 1
When BFS Isn't Enough
BFS layers equal shortest paths only while every edge costs 1 — see why weights break that, and how always expanding the cheapest frontier node (Dijkstra's idea) fixes it.
Complete codeMultiple choice - 2
Shortest Path in Binary Matrix
Classic BFS layers with two twists: neighbors connect in 8 directions, and path length counts CELLS — the start is 1, not 0.
Complete codeDebugMultiple choiceTrace - 3
Shortest Path with Alternating Colors
The state-augmentation lesson: the BFS state is (node, last edge color), not the node — one node can be visited twice, once per arriving color.
Complete codeDebugMultiple choiceTrace - 4
Path with Maximum Probability
Dijkstra flipped upside down: MAXIMIZE a product of probabilities with a max-heap, relaxing when prob[u] * w beats prob[v] — and see why the greedy guarantee survives the flip.
Complete codeDebugMultiple choiceTrace - 5
Path With Minimum Effort
Dijkstra on a different metric: a route's cost is its single WORST step — relax with max(effort so far, height diff), not a sum. Bonus: the same problem falls to binary-search-the-answer.
Complete codeDebugMultiple choiceTrace - 6
Cheapest Flights Within K Stops
The constraint that breaks Dijkstra: with at most K stops, a pricier route using fewer flights can be the right answer — so run K+1 Bellman-Ford rounds over a SNAPSHOT of the previous round's distances.
Complete codeDebugMultiple choiceTrace - 7
Shortest Paths CheckpointCheckpoint
No new concepts — carry the island's tools into unseen territory: fee-loaded toll roads, a board game crossed in dice spins, a maze with one breakable wall, and a flooding grid where only the worst step counts.
Complete codeCode orderMultiple choiceTrace - 8
Shortest Paths ReviewReview
Mixed recap of the island: when plain BFS is enough, the Dijkstra loop with stale-entry skipping, swapping the metric (sum, max, product), states bigger than a node, hop budgets that demand rounds, and what the heap costs you.
Complete codeCode orderMultiple choice - 9
Boss: Network Delay TimeBoss
The island's final duel: one signal, n listeners. Run Dijkstra from node k, skip the heap's stale entries, and remember what the question asks — the network is done when the LAST node hears, so answer with the max arrival time, or -1 if anyone never hears at all.
Complete codeDebugCode orderMultiple choiceTrace
Trees & Graphs is part of AlgoFox Pro
You can read the whole course outline here. The exercises are in the app, along with your streak, your mistake review, and the progress that carries across your devices.
Pro starts with a 3 day free trial. The app store decides who is eligible for an introductory offer, and a lapsed subscription does not get another one.
Already subscribed in the app? Sign in with the same account and Pro works here too. Quick Play and Battle are free on the web, and so is the first course in every subject.
