← Amazon questions

Rotting apples in a 2D grid

Filed under Amazon

Given a 2D grid of 0s (empty), 1s (fresh apples), and 2s (rotten apples), rotten apples rot all 8 adjacent fresh apples in 1 day. Calculate the number of days needed for all apples to rot, or return…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.