Gorgias (CA) interview question

Similar to easy Array Manipulation problems on Leetcode