Two Pointer Problems Leetcode Sql Server