Pregunta de entrevista de EPAM Systems

Technical questions and simple algorithmic task, was need to describe solution