Amazon interview question

Nothing so difficult actually.