Skip to content

Glossary: Coding Interviews in JavaScript

Prefix sum

Also written: prefix sums

An array where `prefix[i]` is the total of the first `i` items. Any range total is then `prefix[end] - prefix[start]`, in O(1) after O(n) setup.

Where the book teaches it

Related terms

Pattern