AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
You are given an `m × n` grid where each cell can have one of three values: `0` representing an empty cell, `1` representing a fresh orange, or `2` representing a rotten orange. Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten. Return the minimum number of minutes that must elapse until no cell has a fresh orange. If this is impossible, return `-1`.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.