We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0445680 commit e0300efCopy full SHA for e0300ef
0053-maximum-subarray/0053-maximum-subarray.java
@@ -6,7 +6,7 @@ public int maxSubArray(int[] nums) {
6
for (int i = 1; i < nums.length; i++) {
7
int num = nums[i];
8
curSum = Math.max(curSum + num, num);
9
- answer = Math.max(curSum, answer);
+ answer = Math.max(answer, curSum);
10
}
11
12
return answer;
0 commit comments