Pergunta de entrevista da empresa DataArt

Seeing the pseudocode I was needed to say what the algorithm it is and fix it