SproutStack logoSproutStack
···

🌱 DSA (Beginner) · Core Patterns · cozy lesson

Kadane: Max Subarray

10 min · 1 min read · no scary math, promise

🤖
You’ve got this. Read a little, play a little — I’ll wait. No rush.
def max_sub(a):
    cur = best = a[0]
    for x in a[1:]:
        cur = max(x, cur + x)
        best = max(best, cur)
    return best

Story: "If my streak so far hurts, start fresh here."

Check your understanding

Correct answers earn XP (once each).

1. Kadane transition?

2. All negatives?

My notes (saved in this browser)

Select text above → Save selection, or write your own. AlgoMaster-style notebook, local-first for MVP.

No notes yet. Your highlights will live here.

Finished reading? Seal it with a tick ✅

The checkbox in the explorer turns green too — same progress.