Two Pointer Approach Leetcode Sql