Amazon interview question

nothing particularly difficult