Practice Problem

Sum of Subarray Minimums

Difficulty: Medium

Given an array of integers, find the sum of the minimum value of every contiguous subarray, modulo 10^9 + 7.