Infosys Interview Question

Challenging task