Leetcode Window Function Postgresql Database