Two Pointer Approach Leetcode Problems Java