Infosys interview question

Nothing much difficult