Nextdoor interview question

Sorting question, basic leetcode problem