标签:desc bar sum cto tor scribe subarray 专业 ++
题目描述
class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { if(array.size()==0) return 0; int nCurSum = 0; int nGreateSum = 0x80000000; for(vector<int>::size_type i = 0; i<array.size(); i++){ if(nCurSum<=0) nCurSum = array[i]; else nCurSum +=array[i]; if(nCurSum > nGreateSum){ nGreateSum = nCurSum; } } return nGreateSum; } };
标签:desc bar sum cto tor scribe subarray 专业 ++
原文地址:http://www.cnblogs.com/xiuxiu55/p/6459471.html