Amazon interview question

Kinda like a GRE reading coding problem