Yandex interview question

Skill, algorithms, etc. As usual.