3835. Count Subarrays With Cost Less Than or Equal to K
You are given an integer array
nums, and an integerk.For any subarray
nums[l..r], define its cost as:
cost = (max(nums[l..r]) - min(nums[l..r])) * (r - l + 1).Return an integer denoting the number of subarrays of
numswhose cost is less than or equal tok.