Sliding Window Algorithm Leetcode Sql