Pregunta de entrevista de Infosys

During the coding questions, asked some modifications and rewrite the code.