Prudential interview question

Programming exercise through code share