Pregunta de entrevista de Point72

Write a SQL query to solve this problem