Prefix Sum | C++ easiest solution
\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>> temp(n+2,vector<int>(n+
```\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>> temp(n+2,vector<int>(n+2,0));\n        int k = queries.size();\n        for(int i=0 ;i < k ;i++)\n        {\n            int x1 = queries[i][0];\n            int y1 = queries[i][1];\n            int x2 = queries[i][2];\n            int y2 = queries[i][3];\n            temp[x1+1][y1+1] += 1;\n            temp[x1+1][y2+2] += -1;\n            temp[x2+2][y1+1] += -1;\n            temp[x2+2][y2+2] += 1;\n        }\n        for(int i=1;i<=n+1;i++)\n        {\n            for(int j=1;j<=n+1;j++)\n            {\n                temp[i][j] = temp[i][j] + temp[i-1][j] + temp[i][j-1] - temp[i-1][j-1];\n            }\n        }\n        vector<vector<int>> ans(n,vector(n,0));\n        for(int i= 1;i<=n;i++)\n        {\n            for(int j=1;j<=n;j++)\n                ans[i-1][j-1] = temp[i][j];\n        }\n        return ans;\n        \n    }\n};\n```
['Array', 'Prefix Sum']