Easy
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# 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```java []\nclass Solution {\n    public int[][] rangeAddQueries(int n, int[][] queries) {\n        int[][] res = new int[n][n];\n        for (var q : queries) {\n            int r0 = q[0], c0 = q[1], r1 = q[2]+1, c1 = q[3]+1;\n            for (int i = r0; i < r1; i++) {\n                res[i][c0]++;\n                if (c1 < n) res[i][c1]--;\n            }\n        }\n\n        for (var row : res)\n            for (int j = 1; j < n; j++)\n                row[j] += row[j-1];\n\n        return res;\n    }\n}\n```
['Java']