Pregunta de entrevista de UC San Diego

The most difficult query I had written in SQL.