Two Pointers Question On Leetcode Sql