Google interview question

Leetcode easy array manipulation question