Jul 26, 2024
A subarray is a contiguous portion of an array.
For example, given the array [3, 1, 2, 4], the possible subarrays are:
Each subarray has a minimum value:
Sum of minima: 3 + 1 + 1 + 1 + 1 + 2 + 2 + 4 = 17.
n
(length of the array).-1
.