JAVA 1ms || 100% || Easy to Understand
Intuition\nPrefix Sum\n\n# Code\n\nclass Solution {\n    public int[][] rangeAddQueries(int n, int[][] queries) {\n        int[][] temp = new int[n][n];\n      
# Intuition\nPrefix Sum\n\n# Code\n```\nclass Solution {\n    public int[][] rangeAddQueries(int n, int[][] queries) {\n        int[][] temp = new int[n][n];\n        for(int[] query : queries){\n            int sr = query[0];\n            int sc = query[1];\n            int er = query[2];\n            int ec = query[3];\n            temp[sr][sc] += 1;\n            if(ec + 1 < n){\n                temp[sr][ec + 1] -= 1;\n            }\n            if(er + 1 < n){\n                temp[er + 1][sc] -= 1;\n            }\n            if(er + 1 < n && ec + 1 < n){\n                temp[er + 1][ec + 1] += 1;\n            }\n        }\n        for(int i = 0; i < n; i++){\n            for(int j = 0; j < n; j++){\n                temp[i][j] += j - 1 >= 0 ? temp[i][j - 1] : 0;\n            }\n        }\n        for(int i = 0; i < n; i++){\n            for(int j = 0; j < n; j++){\n                temp[j][i] += j - 1 >= 0 ? temp[j - 1][i] : 0;\n            }\n        }\n        return temp;\n    }\n}\n```
['Array', 'Matrix', 'Prefix Sum', 'Java']