In a grid, 0=empty, 1=fresh orange, 2=rotten orange. Each minute, rotten oranges spread to adjacent fresh ones. Return minutes until all rot, or -1 if impossible.
Input: [[2,1,1],[1,1,0],[0,1,1]] Output: 4 Input: [[2,1,1],[0,1,1],[1,0,1]] Output: -1
Unlock hints progressively β start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features