Pregunta de entrevista de Infosys

Coding question it was tricky