Start with range sum queries. Precompute the sum of each block in time. For each element at index , add it to .
After processing all elements, holds the sum of block . This preprocessing happens once.
Now queries can skip entire blocks by using precomputed sums instead of iterating through every element. The space is for the block sums array.