Google interview question

Leetcode style question involving arrays