← Questions

Rotting oranges

0
AmazonCodingLast asked Jul 2025

In a grid, cells are empty, fresh fruit or rotten fruit. Each minute, fresh fruit next to rotten fruit (up, down, left, right) rots. Return the minutes until no fresh fruit is left, or -1 if some never rots. Use multi-source breadth-first search.

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