If you have an array of values, how can you take the sum of any range of them in constant time? With a sum table!
Here's a formal definition:
Given a list of values , then a sum table is a corresponding list such that . That is, each value in the sum table is the sum of all the values up until that index. Then, the sum of values between any two can be easily found: .