Infosys Interview Question

Programming Question was asked in the interview