[Python] scanning row strategy
Make a scanning row (r) that you will compare with each row in the matrix. This scanning row tracks the "streak" for each column (how many previous rows had the
Make a scanning row (`r`) that you will compare with each row in the matrix. This scanning row tracks the "streak" for each column (how many previous rows had the bit set in that column). If a row does has a zero for a column the scanning row at that column position gets reset to zero, otherwise the streak count at that column on the scanning row is incremented. \n\nAfter the scanning row is compared with a row, a copy of the scanning row is made and sorted so large values come first (this is equvialent to reordering the columns). Then the value at each row is multiplied by its index plus one. This operation sizes the submatrix and we greedily store the submatrix with the largest size.\n\n```\nclass Solution:\n    def largestSubmatrix(self, matrix: List[List[int]]) -> int:\n        cols = len(matrix[0])\n        r = [0]*cols # scanning row\n        big = 0\n        for row in matrix:\n            for c in range(cols):\n                if 0 == row[c]:\n                    r[c] = 0\n                else:\n                    r[c] += 1\n            count = sorted(r, reverse=True)\n            for idx, v in enumerate(count): # v = streak size aka height of submatrix, idx+1 = width of submatrix\n                big = max((idx+1)*v, big)\n        return big\n```
[]