We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc3d69d commit 5ba1cffCopy full SHA for 5ba1cff
Dynamic-Programming/KadaneAlgo.js
@@ -5,8 +5,7 @@ function KadaneAlgo (array) {
5
cummulativeSum = cummulativeSum + array[i]
6
if (cummulativeSum < 0) {
7
cummulativeSum = 0
8
- }
9
- if (maxSum < cummulativeSum) {
+ } else if (maxSum < cummulativeSum) {
10
maxSum = cummulativeSum
11
}
12
0 commit comments