← Questions
Rotting oranges: time for an infection to cover a grid
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A grid has empty cells, healthy cells and infected cells. Every minute each infected cell infects its healthy neighbors up, down, left and right. Return the minutes until no healthy cell is left, or -1 if some never get infected. Run a breadth-first search from all infected cells at once. Follow-up: infection also spreads diagonally.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
