✅Easy & Best Solution in C++✅ || PrefixSum💯✅
Complexity\n- Time complexity:\nO(n^2)\n\n- Space complexity:\nO(1)\n\n# Code\nPlease Upvote if u liked my Solution\uD83E\uDD17\n\nclass Solution {\npublic:\n  
# Complexity\n- Time complexity:\nO(n^2)\n\n- Space complexity:\nO(1)\n\n# Code\n**Please Upvote if u liked my Solution**\uD83E\uDD17\n```\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>> mat(n,vector<int>(n));\n        for(auto it:queries){\n            int r1=it[0],r2=it[2],c1=it[1],c2=it[3];\n            mat[r1][c1]++;\n            if(c2+1<n)\n                mat[r1][c2+1]--;\n            if(r2+1<n) \n                mat[r2+1][c1]--;\n            if(r2+1<n && c2+1<n)\n                mat[r2+1][c2+1]++;\n        }\n        int prefixSum=0;\n        for(int i=0;i<n;i++){\n            prefixSum=0;\n            for(int j=0;j<n;j++){\n                prefixSum+=mat[i][j];\n                mat[i][j]=prefixSum;\n            }\n        }\n        for(int j=0;j<n;j++){\n            prefixSum=0;\n            for(int i=0;i<n;i++){\n                prefixSum+=mat[i][j];\n                mat[i][j]=prefixSum;\n            }\n        }\n        return mat;\n    }\n};\n```
['Matrix', 'Prefix Sum', 'C++']