Last updated
Was this helpful?
Last updated
Was this helpful?
Given an array of integersA
, find the sum ofmin(B)
, whereB
ranges over every (contiguous) subarray ofA
.
Since the answer may be large,return the answer modulo10^9 + 7
.
Example 1:
Note:
1 <= A.length <= 30000
1 <= A[i] <= 30000
(1) Stack
思路:
(1) Stack: 时间复杂度, 空间复杂度