In a grid, 0 is empty, 1 is a fresh orange, 2 is rotten. Every minute, fresh oranges 4-adjacent to a rotten one rot. Return the minutes until no fresh orange remains, or -1 if that never happens.
Input
r cOutput: minutes, or -1.
3 3 2 1 1 1 1 0 0 1 1
4
3 3 2 1 1 0 1 1 1 0 1
-1
The bottom-left orange is unreachable.
1 3 0 2 0
0
Run your code against the sample tests, or Submit to run the full suite.