书法字典:https://www.shufadict.com

Maximum subsequence sum

This is a very famous problem from programming peals

Given an array of integers, return the maximum
subsequence sum of the array, if the maximus sum
less than 0, return 0
Example
1, 2, -6, 3, -2, 4, -1, 3, 2, -4
return 9
3 + -2 + 4 + -1 + 3 + 2 = 9

 

Code

 

or more concise

Code

 

 

posted on 2009-06-09 17:08  翰墨小生  阅读(407)  评论(0编辑  收藏  举报

导航

书法字典:https://www.shufadict.com