Domanda di colloquio di Fast Enterprises

I was asked to do a pseudo code problem.