Domanda di colloquio di Goldman Sachs

Question related to some search / sort algorithm.