Amazon interview question

See details in previous description