Hi, I have this DnC problem, I would greatly appreciate any help, thank you!
Given an array a with n elements, calculate the sum of min * max over every ranges [l, r] (1 <= l <= r <= n)
Constraints:
1 <= n <= 1e5, 1 <= a_i <= 1e9
Sample test: 4 1 4 3 1
Answer: 58