WHOOP Interview Question

Sorting arrays based on filter