Fiserv interview question

The coding part was a little tough.