Grid Infection Spread Time

Asked at Lyft · Coding Questions · Difficulty: Medium · Last asked May 12, 2026

A grid models a spreading infection. Each cell is empty, healthy (fresh) or infected. Every minute, every infected cell infects all of its healthy 4-directional neighbors (up, down, left, right) at the same time. Compute how long it takes until no healthy cell is left, or report that this never happens.

Loading the problem…