- 1
Grids Are Graphs
A grid is a graph in disguise: spread cell to cell with DFS or BFS, mark visited, and always bounds-check first.
Code orderMultiple choiceTap - 2
Flood Fill
Recolor the start's connected component of same-colored pixels — and dodge the same-color infinite loop.
Complete codeDebugMultiple choiceTrace - 3
Number of Islands
Count DFS launches, not land cells: each launch sinks one whole island.
Complete codeDebugMultiple choiceTapTrace - 4
Max Area of Island
Flood fill that reports back: each DFS call returns 1 + its four neighbors' areas, and the caller keeps the max.
Complete codeDebugMultiple choiceTrace - 5
Surrounded Regions
Don't hunt the surrounded regions — flood from the border 'O's, mark the survivors safe, and flip everything else.
Complete codeDebugCode orderMultiple choiceTrace - 6
01 Matrix
Multi-source BFS: drop every 0 into the queue at distance 0 and let one wave label the whole grid.
Complete codeDebugMultiple choiceTrace - 7
Grid Traversal CheckpointCheckpoint
No new concepts — transfer the island's grid moves to unseen problems: counting exposed edges, islands that dodge the border, BFS through a maze, and painting everything the border can reach.
Complete codeCode orderMultiple choiceTrace - 8
Grid Traversal ReviewReview
Mixed recap of the island: DFS-sink vs multi-source BFS, the border-inversion trick, in-place marking vs a visited array, bounds-check-first discipline, and why it all costs O(mn).
Complete codeDebugCode orderMultiple choice - 9
Boss: Rotting OrangesBoss
The island's final test: every rotten orange spreads at once, so minutes are BFS LAYERS from ALL sources — not steps of one walker. Seed the whole queue at minute 0, count the fresh, and answer -1 only when a fresh orange is unreachable.
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.
