100% || C++
IntuitionFor a matrix with n elements, if you want to increase the elements in range [a,b] such that 0<=a,b<n, you just have to mark arrr[a]=1 and arr[b+1]=-1.
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
For a matrix with n elements, if you want to increase the elements in range [a,b] such that 0<=a,b<n, you just have to mark arrr[a]=1 and arr[b+1]=-1. And then take the prefix sum

Eg : [0,0,0,0,0,0,0,0]

for [1,4]

[0,1,0,0,0,-1,0,0]
After prefix sum : [0,1,1,1,1,0,0,0]
# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {
        vector <vector<int>> ans(n,vector<int>(n,0));

        for(auto &q:queries){
            int r1=q[0];
            int r2=q[2];
            int c1=q[1];
            int c2=q[3];
            for(int i=r1;i<=r2;i++){
                ans[i][c1]++;
                if(c2+1<n) ans[i][c2+1]--;
            }
        }

        for(int i=0;i<n;i++){
            for(int j=1;j<n;j++){
                ans[i][j]+=ans[i][j-1];
            }
        }
        return ans;
    }
};
```
['C++']