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.
Glossary: Coding Interviews in JavaScript
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.