Pregunta de entrevista de Infogain

Coding question in technical interview