Sum of Subarray Ranges
Try to solve the Sum of Subarray Ranges problem.
We'll cover the following...
We'll cover the following...
Statement
Given an integer array nums, consider every non empty contiguous subarray of nums. For each such subarray, define its range as the difference between its maximum element and its minimum element.
Return the sum of these ranges over all non empty contiguous subarrays of nums.
Note: A follow up asks whether you can solve this in
...