Grid

30 articles

dsa2 min read

Flood Fill — DFS Color Replace

Implement the flood fill algorithm (like paint bucket tool): replace all cells of the same color reachable from a starting cell.

Read →
dsa2 min read

Surrounded Regions — Boundary DFS

Capture all 'O' regions not connected to the border. Classic boundary DFS: mark safe cells from edges, then flip remaining O to X.

Read →
dsa2 min read

Rotting Oranges — Multi-Source BFS

Find minimum minutes until all oranges rot. Multi-source BFS: push all initially-rotten oranges into queue simultaneously, BFS layer by layer.

Read →