Practice40 min

Practice: BFS Waves

Multi-source BFS for spreading distance and time, and BFS over word-transformation states.

Seed every gate, every rotten orange, into the queue at distance 0 and let one wave answer the whole grid — then Word Ladder, where the "graph" is invisible: nodes are words, edges are one-letter changes, and shortest transformation = BFS distance.

Solving all problems completes this lesson automatically.