Implement BFS and DFS on Grids

flood fill and grid shortest paths

Challenge 2 of GraphsIntermediate~55 minFree

Traverse 2D grids with breadth-first and depth-first search. Build a neighbor helper, then use it for flood fill, island counting, shortest paths, and largest-region sizing, the same tools behind paint-bucket fills, maze solvers, and image region detection.

5 steps

  1. 1Neighbors
  2. 2Flood fill
  3. 3Count islands
  4. 4Shortest path
  5. 5Largest region
Start step 1