Amazon interview question

about algorithems