WHOOP interview question

Sorting arrays based on filter