✔ Python3 Solution | 100% faster | O(n * n)
Complexity\n- Time complexity: O(n * n)\n- Space complexity: O(n * n)\n\n# Code\n\nclass Solution:\n    def rangeAddQueries(self, n: int, queries: List[List[int
# Complexity\n- Time complexity: $$O(n * n)$$\n- Space complexity: $$O(n * n)$$\n\n# Code\n```\nclass Solution:\n    def rangeAddQueries(self, n: int, queries: List[List[int]]) -> List[List[int]]:\n        mat = [[0] * n for _ in range(n)]\n        for r1, c1, r2, c2 in queries:\n            mat[r1][c1] += 1\n            if r2 + 1 < n: mat[r2 + 1][c1] -= 1\n            if c2 + 1 < n: mat[r1][c2 + 1] -= 1\n            if r2 + 1 < n and c2 + 1 < n: mat[r2 + 1][c2 + 1] += 1\n        for i in range(n):\n            for j in range(1, n):\n                mat[i][j] += mat[i][j - 1]\n        for i in range(1, n):\n            for j in range(n):\n                mat[i][j] += mat[i - 1][j]\n        return mat\n```
['Matrix', 'Prefix Sum', 'Python3']