DXC Technology interview question

A leetcode easy question on two pointers.