Python - brute force optimization
Intution \n- This problem is similar to Array Manipulation problem on hackerrank.\n- We would manipulate each row of matrix and then calculate prefix sum.\n----
# Intution \n- This problem is similar to [Array Manipulation](https://www.hackerrank.com/challenges/crush/problem) problem on hackerrank.\n- We would manipulate each row of matrix and then calculate prefix sum.\n-----------\n- We would apply each wuery one by one and in each query we will go in each row one by one in the submatrix.\n- For manipulation in each row instead of iterating through whole row we will update elements only at matrix[col_start, col_end+1].\n- At last calculate prefix sum for each row.\n\n# Complexity\n- Time complexity: O(n<sup>2</sup>)\n- Space complexity: O(n<sup>2</sup>)\n\n# Code\n```\nclass Solution:\n    def rangeAddQueries(self, n: int, queries: List[List[int]]) -> List[List[int]]:\n        m = [[0]*n for i in range(n)]\n        for q in queries:\n            sr, sc, er, ec = q\n            for i in range(sr, er+1):\n                m[i][sc] += 1\n                if ec+1 < n:\n                    m[i][ec+1] -=1\n        \n        for i in range(n):\n            for j in range(1, n):\n                m[i][j] += m[i][j-1]\n                \n        return m\n```\n---------------\n**Upvote the post if you find it helpful.\nHappy coding.**
['Python3']