Pregunta de entrevista de HackerRank

Writing a SQL query for some problem that I don't remember