Microsoft interview question

Typical array manipulation questions from leetcode.