Range Sum Query — interactive algorithm visualization
Easy · Prefix Sum · time O(n) · space O(n)
Precompute cumulative sums so any range sum is a single subtraction. Turns O(n) queries into O(1).
Example input: nums = [3,1,4,1,5,9,2,6], range [2,5]
Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.