Infosys interview question

Not cleared coding round , only solved 1 question