Pergunta de entrevista da empresa WHOOP

Sorting arrays based on filter