Fidessa interview question

Hackerank coding challenge