Array Reduction 3 Hackerrank Practice