Infosys interview question

coding based question related to your knowledge