FIS interview question

Had to code for a scenario.