Morgan Stanley interview question

Leetcode easy or medium working with arrays