[Python] Clear Solution with Video Explanation
Video with clear visualization and explanation:\nhttps://youtu.be/-YVsiCrbeRE\n\n\n\nIntuition: Largest rectangle in histogram with reversed sort\n\n\nCode\n\nc
Video with clear visualization and explanation:\nhttps://youtu.be/-YVsiCrbeRE\n\n\n\nIntuition: Largest rectangle in histogram with reversed sort\n\n\n**Code**\n```\nclass Solution:\n    def largestSubmatrix(self, matrix: List[List[int]]) -> int:\n        n_r, n_c, res = len(matrix), len(matrix[0]), 0\n\n        for r in range(1, n_r):\n            for c in range(n_c):\n                matrix[r][c] += matrix[r-1][c] if matrix[r][c] else 0\n\n        for r in range(n_r): \n            matrix[r].sort(reverse = True)\n            for c in range(n_c):\n                res = max(res, (c+1)*matrix[r][c])\n                \n        return res\n```\n\n\nTime: O(m*n *logn) / Space: O(1)\n\n\nFeel free to subscribe to my channel. More LeetCoding videos coming up!
['Python']