C++ || PrefixSum || DP memoized
\nclass Solution {\n    int solve(string &s, int nc, int &lc, vector<int> &pref, int i, vector<vector<int>> &dp)\n    {\n        if(i<0) return 0;\n        if(n
```\nclass Solution {\n    int solve(string &s, int nc, int &lc, vector<int> &pref, int i, vector<vector<int>> &dp)\n    {\n        if(i<0) return 0;\n        if(nc==0) return pref[i];\n        if(dp[i][nc]!=-1) return dp[i][nc];\n        \n        int take = solve(s,nc-1,lc,pref, i-lc, dp);\n        int not_take = (s[i] - \'0\') + solve(s,nc,lc,pref,i-1,dp);\n        \n        return dp[i][nc] = min(take,not_take);\n    }\npublic:\n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        vector<int> pref;\n        int sum =0;\n        for(int i=0; i<floor.length(); i++)\n        {\n            sum += (floor[i]-\'0\');\n            pref.push_back(sum);\n        }\n        vector<vector<int>> dp(floor.length()+1, vector<int>(numCarpets+1,-1));\n        return solve(floor, numCarpets, carpetLen, pref, floor.length()-1, dp);\n        \n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Prefix Sum']