对于数组中的每个数,用单调栈去求它左、右两边分别大于它的数的位置,比如分别在 i 和 j 。
那么在开区间(i , j )中,这个数是最小的。
ans = min(sum(i + 1, j - 1) * num[index]) --> (0 <= index < n)
对于数组中的每个数,用单调栈去求它左、右两边分别大于它的数的位置,比如分别在 i 和 j 。
那么在开区间(i , j )中,这个数是最小的。
ans = min(sum(i + 1, j - 1) * num[index]) --> (0 <= index < n)