Lime interview question

A problem on 2 pointers on hacker rank