C++ | DP | MEMOIZATION
\nclass Solution {\npublic:\n    \n    int helper(string &s, int num, int len, int i, vector<vector<int>>&dp){\n        if(i>=s.length()){\n            return 0
```\nclass Solution {\npublic:\n    \n    int helper(string &s, int num, int len, int i, vector<vector<int>>&dp){\n        if(i>=s.length()){\n            return 0;\n        }\n        if(num==0){\n            int count = 0;\n        for(int j = i; j<=s.length()-1;j++){\n            if(s[j]==\'1\'){\n                count++;\n            }\n\n        } \n                       return count;\n        }\n        if(dp[i][num]!=-1){\n            return dp[i][num];\n        }\n        if(s[i]==\'0\'){\n            return dp[i][num] = helper(s,num,len,i+1,dp);\n        }\n        int mn = i + len-1;\n        if(mn >= s.length()){\n            mn = s.length()-1;\n        }\n    \n        return dp[i][num] = min(helper(s,num-1,len,i+len,dp),1+helper(s,num,len,i+1,dp));\n    }\n    \n    \n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        vector<vector<int>> dp(floor.length()+1, vector<int>(numCarpets+1,-1));\n        return helper(floor,numCarpets,carpetLen,0,dp);\n    }\n};\n```
['Memoization', 'C']