Log in to run or submit
Kadane’s algorithm.
Track best subarray ending at current index: cur = max(x, cur+x); update global best.
cur = max(x, cur+x)