Window Function Sql Questions Hackerrank Javascript