Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25864b9

Browse files
kadane's algorithm
1 parent 5cb80ca commit 25864b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎maxSubArrSum.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using namespace std;
77

88
int maxSubArrSum(int a[], int sz) {
99
int cur_max = a[0], global_max = a[0];
10-
for (int i = 0; i < sz; i++) {
10+
for (int i = 1; i < sz; i++) {
1111
cur_max = max(a[i], cur_max + a[i]);
1212
global_max = max(global_max, cur_max);
1313
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /