PriceLabs Interview Question

Pseudo Code that was provided