Dynamic Programming based solution || Recursion + Memoization || C++ Clean Code
Code :\n\n\n class Solution {\n    vector<int> whiteCount; // Stores no. of white tiles from ith index till the end\n    \n\t// Count number of white tile from 
# Code :\n\n```\n class Solution {\n    vector<int> whiteCount; // Stores no. of white tiles from ith index till the end\n    \n\t// Count number of white tile from index till end \n\t// Suffix sum of no. of white tiles\n    void countTiles(string& floor, int n) {\n        whiteCount.resize(n+2, 0);\n        \n        for(int i=n-1; i>=0; i--) {\n            whiteCount[i] = whiteCount[i+1] + (floor[i] == \'1\');\n        }\n    }\n    \n    int uncoveredWhiteTiles(string& floor, vector<vector<int>>& dp, int numCarpets, int idx, int carpetLen, int n) {\n        \n\t\t// If we reach the end, then no white is remaining\n\t\t// Assuming that all previous white tiles are covered already using carpets\n        if(idx >= n) {\n            return 0;\n        }\n\t\t// If no carpet is available, then all the white tiles from current index\n\t\t// Till the end are uncovered. Hence return its count\n        if(numCarpets == 0) {\n            return whiteCount[idx];\n        }\n        \n\t\t// If we have some value for current state in DP table, then return it\n        if(dp[idx][numCarpets] != -1) return dp[idx][numCarpets];\n        \n        int countWhites = n;\n        \n        // We have two choices at this point\n\t\t// Choice 1 : Use a carpet starting from current index till carpetLen\n\t\t// Choice 2 : Do no use any carpet, and move to next index. \n\t\t// But if current tile is white then count it as uncovered\n        countWhites = min(\n            uncoveredWhiteTiles(floor, dp, numCarpets-1, idx+carpetLen, carpetLen, n),\n            uncoveredWhiteTiles(floor, dp, numCarpets, idx+1, carpetLen, n) + (floor[idx] == \'1\')\n        );\n        \n\t\t// Return minimum count of uncovered white tiles using one of the two choices\n        return dp[idx][numCarpets] = countWhites;\n    }\n    \npublic:\n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        int n = floor.size();\n        countTiles(floor, n);\n        vector<vector<int>> dp(n+1, vector<int>(numCarpets+1, -1));\n         \n        return uncoveredWhiteTiles(floor, dp, numCarpets, 0, carpetLen, n);\n    }\n};\n```\n\n**Complexity :**\n\n* Time : `O(N*M)` \n* Space : `O(N*M)`\n\t* N : length of `floor` string\n\t* M : number of carpets available\n\n***If you find this helpful, do give it a like :)***
['Dynamic Programming', 'Memoization', 'C']