Pergunta de entrevista da empresa phData

a question about reducing 2 for loops to 1