Given an array of integers nums, determine the maximum alternating subarray sum among all non empty subarrays of nums.
The alternating sum of a subarray starting at index i and ending at index j inclusive (
nums[i] nums[i + 1] nums[i + 2] nums[i + 3]
where the signs alternate between addition and subtraction, beginning with addition for the first element nums[i].
Return the maximum alternating sum of any non empty subarray.
Constraints:
nums.length
nums[i]
Given an array of integers nums, determine the maximum alternating subarray sum among all non empty subarrays of nums.
The alternating sum of a subarray starting at index i and ending at index j inclusive (
nums[i] nums[i + 1] nums[i + 2] nums[i + 3]
where the signs alternate between addition and subtraction, beginning with addition for the first element nums[i].
Return the maximum alternating sum of any non empty subarray.
Constraints:
nums.length
nums[i]