DEV Community

Discussion on: Kadane's Algorithm & The Maximum Subarray Problem

Collapse
 
santech404 profile image
san-tech-404

if (maxCurrent > maxGlobal) {
maxGlobal = maxCurrent;

instead of this why dont we say
maxGlobal = Math.max(maxCurrent, maxGlobal)