Fidessa Interview Question

Hackerank coding challenge