```
private int[] sums = null;
public NumArray(int[] nums) {
this.sums = new int[nums.Length + 1];
for (int i = nums.Length - 1; i >= 0; i--)
{
this.sums[i] = this.sums[i+1] + nums[i];
}
}
public int SumRange(int i, int j) {
return this.sums[i] - this.sums[j+1];
}
```