Domanda di colloquio di Reddit

Coding question involving some sorting. I can't remember the exact question.