PriceLabs interview question

Pseudo Code that was provided