Skip to content
SparkTime, home

Tagged #prefix sums

GuideTechnology

19 min read

Prefix Sums and Difference Arrays

Answer range-sum queries in constant time with a running-total array, count subarrays with a given sum using a hash map, compute product-except-self, handle 2D regions, and apply many range updates at once with a difference array.