C++||Simple and Most Easy Solution with Explanation
Using Scanline Algorithm\n\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int
**Using Scanline Algorithm**\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(int i=0;i<queries.size();i++)\n        {\n            int rs=queries[i][0];\n            int cs=queries[i][1];\n            int re=queries[i][2];\n            int ce=queries[i][3];\n            for(int j=rs;j<=re;j++)\n            {\n                mat[j][cs]+=1;//doing +1 to start column for each row\n                if(ce<n-1)\n                    mat[j][ce+1]-=1;//doing -1 to endcolumn+1  for each row \n            }\n        }\n        for(int i=0;i<n;i++)\n        {\n            for(int j=1;j<n;j++)\n            {\n                mat[i][j]+=mat[i][j-1];//generating prefix sum of each row\n            }\n        }\n        return mat;\n    }\n};\n```
[]