//连续子数组的最大值
class Solution {
public:
int FindGreatestSumOfSubArray(vector<int> array) {
int res = INT_MIN,s=0;
int n = array.size();
for(int i=0;i<n;i++)
{
if(s < 0) s = 0;
s += array[i];
res = max(res,s);
}
return res;
}
};
class Solution {
public:
int FindGreatestSumOfSubArray(vector<int> array) {
int res = INT_MIN,s=0;
int n = array.size();
for(int i=0;i<n;i++)
{
if(s < 0) s = 0;
s += array[i];
res = max(res,s);
}
return res;
}
};
2020-05-03
在牛客打卡11天,今天学习:刷题 5 道/代码提交 5 次
全部评论
相关推荐
04-21 22:05
深度学习 点赞 评论 收藏
分享
在平静中度过当下:如果这个bg也简历挂的话可能他们现在不缺人了吧,我也是这两天投的,阿里和快手投的岗都是简历秒挂


点赞 评论 收藏
分享
查看3道真题和解析