Reddit interview question

SQL queries with window functions