easy c++ solution using prefix sum and dynamic programming
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```\nclass Solution {\npublic:\n    int f(int i,string &floor,int numCarpets,int carpetLen,vector<vector<int>> &dp,vector<int> &suff_sum)\n    {\n        if(i>=floor.size())return 0;\n        if(numCarpets==0)\n        {\n           // int count=0;\n           // for(int j=i;j<floor.size();j++){if(floor[j]==\'1\')count++;}\n            return suff_sum[i];\n        }\n        if(dp[i][numCarpets]!=-1)return dp[i][numCarpets];\n        int take=f(i+carpetLen,floor,numCarpets-1,carpetLen,dp,suff_sum);\n        int not_take=0;\n        if(floor[i]==\'1\')not_take=1+f(i+1,floor,numCarpets,carpetLen,dp,suff_sum);\n        else not_take=f(i+1,floor,numCarpets,carpetLen,dp,suff_sum);\n        return dp[i][numCarpets]=min(take,not_take);\n    }\n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        int n=floor.size();\n        vector<vector<int>> dp(n,vector<int>(numCarpets+1,-1));\n        vector<int> suff_sum(n,0);\n        suff_sum[n-1]+=(floor[n-1]==\'1\');\n        for(int i=n-2;i>=0;i--)\n        {\n            if(floor[i]==\'1\')suff_sum[i]++;\n            suff_sum[i]+=suff_sum[i+1];\n        }\n       return f(0,floor,numCarpets,carpetLen,dp,suff_sum);\n    }\n};\n```
['C++']