Approach hintTry it first, then revealHide
Start a BFS from all rotten oranges at once; the number of BFS layers is the elapsed time. If some fresh orange is never reached, the answer is -1.
Start a BFS from all rotten oranges at once; the number of BFS layers is the elapsed time. If some fresh orange is never reached, the answer is -1.