Solved LeetCode program · 871 of 1,000
#1186 · Maximum Subarray Sum with One Deletion
Original English source
The numbers is a list of 1, -2, 0, and 3. The keep is item 0 of numbers. The skip is item 0 of numbers. The best is item 0 of numbers.
For every spot from 1 to 3.
The value is item spot of numbers. The fresh is keep plus value. If value is more than fresh, set fresh to value. The bent is skip plus value. If keep is more than bent, set bent to keep. Set keep to fresh. Set skip to bent. If keep is more than best, set best to keep. If skip is more than best, set best to skip.
Show best.
Expected stdout
4