Given an integer array nums, calculate and return the alternating sum of its elements.
The alternating sum of an array is computed by adding the elements at even indices and subtracting the elements at odd indices.
Constraints:
nums.length
nums[i]
Given an integer array nums, calculate and return the alternating sum of its elements.
The alternating sum of an array is computed by adding the elements at even indices and subtracting the elements at odd indices.
Constraints:
nums.length
nums[i]