Pregunta de entrevista de EPAM Systems

How to solve this specific problem