The TransCompilator

Solved LeetCode program · 675 of 1,000

#0907 · Sum of Subarray Minimums

Medium Array chunk-14.md

Original English source

The numbers is a list of 3, 1, 2, and 4. The last is the last position of numbers. The total is 0.
For every start from 0 to last.
The lowest is item start of numbers.
For every finish from start to last.
If item finish of numbers is less than lowest, set lowest to item finish of numbers. Increase total by lowest.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

17