You are given an integer array
nums.The alternating sum of
numsis the value obtained by adding elements at even indices and subtracting elements at odd indices. That is,nums[0] - nums[1] + nums[2] - nums[3]...Return an integer denoting the alternating sum of
nums.
1 | class Solution { |