Infosys interview question

Coding interview