Kadane's algorithm

medium

Is the run so far helping or hurting? If it has gone negative it can only drag down whatever follows, so discard it. That single comparison is the whole algorithm - and it is dynamic programming in disguise.

Worst O(n)Space O(1)
Loading the kadane's algorithm engine…

Where to go next