Question
A grid contains healthy cells (`0`) and infected cells (`1`). Each day, infection spreads simultaneously from infected cells to their four orthogonal healthy neighbors. Return the number of days until every susceptible cell is infected, or `-1` if that cannot happen. ```python def days_to_infect(grid: list[list[int]]) -> int: ... ``` ## Requirements - All initially infected cells spread at the same time. - Return `0` when no healthy cell exists initially. - Do not allow newly infected cells to spread again during the same day. - Handle empty grids and validate rectangular input. - Target `O(rows * cols)` time and space proportional to the active frontier. In the second stage, cells marked `2` are immune: they never change and block propagation. ## Follow-ups 1. Add recovery after a configurable number of days. 2. Require at least `q` infected neighbors before a cell changes. 3. Support different infection delays per cell. 4. Return the infection day for every cell or the original source that reached it.