Pregunta de entrevista de JPMorganChase

SQL query based on window functions.