python3 dp beats 93%
\n\n# Code\n\nclass Solution:\n    def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int) -> int:\n        floor = \'0\'+floor\n        dp = [
\n\n# Code\n```\nclass Solution:\n    def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int) -> int:\n        floor = \'0\'+floor\n        dp = [[inf for x in range(len(floor))] for y in range(numCarpets+1)]\n        c = 0\n        for i in range(len(floor)):\n            if floor[i]==\'1\':\n                c+=1\n            dp[0][i] = c\n\n        \n        for r in range(1,numCarpets+1):\n            for c in range(len(floor)):\n                if c==0:\n                    dp[r][c]=0\n                    continue\n                if floor[c]==\'0\':\n                    dp[r][c] = dp[r][c-1]\n                else:\n                    dp[r][c] = min(dp[r][c-1]+1,dp[r-1][max(0,c-carpetLen)])\n\n        return dp[-1][-1]\n\n        \n```
['Python3']