Amazon interview question

Problem solving - Rotten Oranges problem