Two Pointer Technique Leetcode Javascript Problems