dp and prefix sum
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {
        const int n = floor.size();
        vector<vector<int>> dp(n + 1, vector<int>(numCarpets + 1, n));

        for (int i = 0; i <= numCarpets; ++ i)
            dp[0][i] = 0;
        for (int i = 1; i <= n; ++ i)
        {
            dp[i][0] = dp[i - 1][0] + static_cast<int>(floor[i - 1] == '1');
        }
        for (int i = 1; i <= n; ++ i)
        {
            for (int j = 1; j <= numCarpets; ++ j)
            {
                dp[i][j] = min(i < carpetLen ? 0 : dp[i - carpetLen][j - 1],
                               dp[i - 1][j] + static_cast<int>(floor[i - 1] == '1'));
            }
        }

        return dp.back().back();
    }
};
```
['C++']