Amazon interview question

standard coding challenges involving algorithm