Gorgias (CA) interview question

Similar to Array Manipulation easy problems on Leetcode