Pregunta de entrevista de EPAM Systems

They asked me to write code on given senario