Amazon interview question

It was a generic two-pointer problem.