Fast Enterprises Interview Question

I was asked to do a pseudo code problem.