Yandex interview question

LeetCode easy question on array