Amazon interview question

Nothing particularly hard.