You are given an integer array nums of length k.
The value of a contiguous subarray is defined as the difference between its maximum element and its minimum element.
You must select nums. Return the maximum possible sum of the values of the chosen subarrays.
Constraints:
nums.length
nums[i]
You are given an integer array nums of length k.
The value of a contiguous subarray is defined as the difference between its maximum element and its minimum element.
You must select nums. Return the maximum possible sum of the values of the chosen subarrays.
Constraints:
nums.length
nums[i]