Pregunta de entrevista de Kiwi.com

Write complex SQL query using window functions (input table had > 1 million rows)