Prefix sum || C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n        O(n*n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n        O(n*n)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>>mat(n,vector<int>(n,0));\n        for(auto q : queries){\n            mat[q[0]][q[1]]++;\n            if(q[2]+1<n && q[3]+1<n) mat[q[2]+1][q[3]+1]++;\n            if(q[3]+1<n) mat[q[0]][q[3]+1]--;\n            if(q[2]+1<n) mat[q[2]+1][q[1]]--; \n        }\n        for (int r = 1; r < n; r ++) {\n            for (int c = 0; c < n; c ++) mat[r][c] += mat[r-1][c];\n        }\n        for (int r = 0; r < n; r ++) {\n            for (int c = 1; c < n; c ++) mat[r][c] += mat[r][c-1];\n        }\n        return mat;\n    }\n};\n```
['Prefix Sum', 'C++']