YANDEX interview question

got task to solve with two pointers