Pregunta de entrevista de SISTIC.com

SQL question related to querying with group by, window functions and CTEs