Leetcode Window Function Postgresql Version