Amazon interview question

They asked a two pointer question from Leetcode