标签:
1 class Solution { 2 public: 3 int maxSubArray(int A[], int n) { 4 int result = A[0], sum = A[0]; 5 for (int i = 1; i < n; i++) { 6 sum = max(sum + A[i], A[i]); 7 result = max(result, sum); 8 } 9 return result; 10 } 11 };
标签:
原文地址:http://www.cnblogs.com/shuashuashua/p/4355081.html