Coupa Software Inc interview question

Ruby problem based on the scenario