Compare nested-loop sum vs prefix-sum optimization!
For each subarray, iterate through all elements and add them up.
Precompute prefix sum, then calculate range sum with one subtraction.