[Python] prefix sum, sort rows, compute areas - O(m*nlogn) runtime - with explanation
\nApproach: O(m\*nlogn) runtime O(1) space - 1116ms (97.79%), 40.7MB (47.17%)\nCompute prefix from top to bottom. Reset everytime we reach a 0.\nNow go to each 
\nApproach: O(m\\*nlogn) runtime O(1) space - 1116ms (97.79%), 40.7MB (47.17%)\nCompute prefix from top to bottom. Reset everytime we reach a 0.\nNow go to each row and compute area for each value (starting from right to left). For each value, we will use all values to the right of it (including itself) to compute area.\nSo basically we are getting the area for each given value in the row.\nDiagram example: https://drive.google.com/file/d/1W0LWFdMwXqstlwySBERkJ_I11QWIq-0V/view?usp=sharing\nNote that the sorting of the previous row would not ruin the answer obtained from calculating area in the next row because we\'re using prefix sum.\n```\nfrom typing import List\nimport numpy as np #for printing\nclass Solution:\n    def largestSubmatrix(self, matrix: List[List[int]]) -> int:\n        \n        m = len(matrix)\n        n = len(matrix[0])\n\n        #get prefix sum of rows (reset upon hitting 0)\n        for j in range(n):\n            for i in range(m):\n                #for each column iterate down the rows and calculate prefix sum\n                if i > 0:\n                    if matrix[i][j] != 0:\n                        #0 means reset\n                        matrix[i][j] += matrix[i-1][j]\n        \n        #print(np.array(matrix))\n\n        #iterate through each row, sort, and compute max area\n        maxArea = 0\n        for row in matrix:\n            row.sort()\n            #iterate from right to left and compute area for each set of number\n            index = len(row) - 1\n            while index >= 0:\n                #get value\n                value = row[index]\n                #keep going left if it\'s still the same value\n                while index-1 >= 0 and row[index-1] == value:\n                    index -= 1\n                #compute area (we multiply value by the number of items to the right including itself)\n                area = value * (len(row)-index)\n                if area > maxArea:\n                    maxArea = area\n                index -= 1\n        return maxArea\n```
['Sorting', 'Prefix Sum', 'Python', 'Python3']