Dream Security interview question

Easy-level LeetCode-style problem about arrays