Range Sum Query - Immutable
Description
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.
Example:
Note:
You may assume that the array does not change.
There are many calls to
sumRange
function.
Solution
sums[i]
: the sum of first i numbers.
Last updated