Array
Prefix sum
Query range
Result

Controls

Build: O(n) | Query: O(1)

Steps

0 steps

Press Build & Query to trace the algorithm one step at a time.