class NumArray {

```
vector<int> mat;
```

public:

```
NumArray(vector<int> &nums) {
int size=nums.size(),i;
mat.resize(size+1);
mat[0]=0;
for(i=1;i<=size;i++){
mat[i]=mat[i-1]+nums[i-1];
}
}
int sumRange(int i, int j) {
return mat[j+1] - mat[i];
}
```

};