Pregunta de entrevista de Capgemini

In technical round, I was asked to write a codes.