Infosys Interview Question

Not cleared coding round , only solved 1 question