Pergunta de entrevista da empresa Indeed

How would you approach this problem using sql?