Humu interview question

Solve a medium Leetcode question about array manipulation