1. Kadane: Extend or Restart Optimal
Intuition
At each element there is one question: is the run so far helping? If the total behind you is negative it is dead weight, and starting fresh at this element beats carrying it. That single decision — extend or restart — is Kadane's algorithm, and the running best is recorded separately so a later decline cannot erase an earlier peak.
Algorithm
1. Start both the running total and the best at the first element.
2. For each next element, take the larger of the element alone and the element plus the running total.
3. Update the best with the running total.
Time & Space
Time O(n). Space O(1). The divide-and-conquer version is O(n log n) and worth naming as the follow-up.