Python Solution for minimumWhiteTiles
Code\npython []\nclass Solution(object):\n\n    def minimumWhiteTiles(self, floor, numCarpets, carpetLen):\n\n        mat = [[0 for i in range(0,len(floor))] fo
# Code\n```python []\nclass Solution(object):\n\n    def minimumWhiteTiles(self, floor, numCarpets, carpetLen):\n\n        mat = [[0 for i in range(0,len(floor))] for j in range(0,numCarpets+1)]\n\n        count = 1\n\n        temp_count = 0\n\n        for i in range(0,len(floor)):\n\n            if floor[i]==\'1\':\n\n                mat[0][i] = count\n\n                temp_count = count\n\n                count = count+1\n\n\n            else:\n\n                mat[0][i] = temp_count\n\n        for i in range(1,numCarpets+1):\n\n            for j in range(0,carpetLen-1):\n\n                mat[i][j] = 0\n\n        \n\n\n        for i in range(1,numCarpets+1):\n\n            for j in range(carpetLen-1,len(floor)):\n\n                if j==carpetLen-1:\n                    mat[i][j]=0\n                    continue\n\n                num_whites = mat[i-1][j]-mat[i-1][j-carpetLen]\n\n                reduced_whites = num_whites - carpetLen\n\n                if reduced_whites<0:\n\n                    reduced_whites = 0\n\n                mat[i][j] = min(mat[i-1][j]+mat[i][j-1]-mat[i-1][j-1],mat[i-1][j-carpetLen]+reduced_whites)\n\n        return mat[-1][-1]\n```
['Python']