DataArt Interview Question

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