DSA · Reimagined
Arrays easy time O(n) space O(1)

Prefix Sum

Each position becomes the sum of everything up to and including it: a[i] += a[i-1]. Afterwards any range sum is a single subtraction.

3
0
1
1
4
2
1
3
5
4
9
5
2
6

Build running totals in place.

1 / 14

Practice

Machine twin: /dsa-viz-v2/prefix-sum.json — the full deterministic run as structured data.