Pregunta de entrevista de Nextdoor

Sorting question, basic leetcode problem