题解 | #字符个数统计#
int maxsumofSubarray(int* arr, int arrLen ) {
// write code here
int dp[arrLen+1]; memset(dp,0,arrLen+1); dp[0] = arr[0]; int max = dp[0]; for(int i=1;i<arrLen;i++) { dp[i] = dp[i-1]+arr[i] > arr[i] ? dp[i-1]+arr[i]:arr[i]; max = dp[i]>dp[i-1] ? dp[i]:dp[i-1]; } return max;
}