Infosys interview question

A puzzle