Mental Model
Find the biggest sum of any continuous part of a list by keeping track of the best sum ending at each position.
Analogy: Imagine walking along a path with ups and downs in height. You want to find the highest hill segment you can climb without stopping. You keep track of the best climb you can make ending at each step.
Array: [ -2, 1, -3, 4, -1, 2, 1, -5, 4 ] Index: 0 1 2 3 4 5 6 7 8 At each step: max_ending_here -> current best sum ending here max_so_far -> best sum found so far
