Array Reduction 3 Leetcode 150 Solution