Two Pointers Questions Leetcode Javascript 30