DP, O(n^2) TC
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n        \n    def __init__(self):\n        self.mem = {}\n        self.pref = []\n        \n    def findMin(self, floor, i, j, ln):\n        n = len(floor)\n        if j == 0:\n            return self.pref[n - 1] - (self.pref[i - 1] if i > 0 else 0)\n        if n - i < ln and j > 0:\n            return 0\n        if (i, j) in self.mem:\n            return self.mem[(i, j)]\n        ans = 10**9\n        if floor[i] == \'1\' and n - i >= ln:\n            ans = min(ans, self.findMin(floor, i + ln, j - 1, ln))\n            ans = min(ans, 1 + self.findMin(floor, i + 1, j, ln))\n        elif floor[i] == \'0\' and n - i >= ln:\n            ans = min(ans, self.findMin(floor, i + ln, j - 1, ln))\n            ans = min(ans, self.findMin(floor, i + 1, j, ln))\n        self.mem[(i, j)] = ans\n        return ans\n    \n    def minimumWhiteTiles(self, floor: str, numCarpets: int, carpetLen: int) -> int:\n        n = len(floor)\n        for i in range(n):\n            self.pref.append((self.pref[-1] if self.pref else 0) + int(floor[i]))\n        return self.findMin(floor, 0, numCarpets, carpetLen)\n        \n```
['Python3']