Pergunta de entrevista da empresa Goldman Sachs

Question related to some search / sort algorithm.