Sum of Subarray Minimums
Medium · Stack & Monotonic Stack · about 30 minutes
Asked at Amazon, Microsoft, Google, Bloomberg.
For every contiguous slice of arr, take the smallest value in that slice, and add all of these minimums together. The total can be huge, so return it modulo 10⁹ + 7.