Pergunta de entrevista da empresa Citadel Securities

How can you solve this arrangement puzzle?