C++ | Easy | Beginner Friendly
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\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(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 x : queries){\n            int a = x[0],b = x[1],c = x[2],d = x[3];\n            mat[a][b] += 1;\n            if(d+1 < n) mat[a][d+1] -= 1;\n            if(c+1 < n) mat[c+1][b] -= 1;\n            if(c+1 < n && d+1 < n) mat[c+1][d+1] += 1;\n        }\n        for(int i = 0;i < n;i++){\n            for(int j = 1;j < n;j++){\n                mat[i][j] += mat[i][j-1];\n            }\n        }\n        for(int j = 0;j < n;j++){\n            for(int i = 1;i < n;i++){\n                mat[i][j] += mat[i-1][j];\n            }\n        }\n        return mat;\n    }\n};\n```
['C++']