EPAM Systems interview question

Intermediate written test for a generic problem.