Solved LeetCode program · 53 of 1,000
#0053 · Maximum Subarray
Original English source
The nums is a list of -2, 1, -3, 4, -1, 2, 1, -5, and 4. The best is item 0 of nums. The current is 0.
For every position from 0 to the last position of nums.
Set current to the larger of current plus item position of nums and item position of nums. Set best to the larger of best and current.
Report best.
Expected stdout
6