You are given an array of integers, find the sum of all minimum values of every subarray of that given array.
size of array <= 3*10^4 >= elements of array
Example: nums = [2,1,3]
subarray minimum value
2 2
2, 1 1
2, 1, 3 1
1 1
1, 3 1
3 3
-----------------
sum = 9, that's the answer.
No comments:
Post a Comment