You are given an integer array nums of length k.
A subarray nums[i..j] is called good if the absolute difference between its first and last elements is equal to k, which means nums[i] - nums[j]|$ = k$.
Return the maximum sum of a good subarray. If no good subarray can be found, return
Note: A subarray is a contiguous non empty sequence of elements within an array.
Constraints:
nums.length
nums[i]
k
You are given an integer array nums of length k.
A subarray nums[i..j] is called good if the absolute difference between its first and last elements is equal to k, which means nums[i] - nums[j]|$ = k$.
Return the maximum sum of a good subarray. If no good subarray can be found, return
Note: A subarray is a contiguous non empty sequence of elements within an array.
Constraints:
nums.length
nums[i]
k