C++ Solution | Memo + recursive + prefix array
So , Here i changed the question instead of finding the minimum no of white tiles after placing k tiles , I am trying to find the maximum white tiles i can cove
So , Here i changed the question instead of finding the minimum no of white tiles after placing k tiles , I am trying to find the maximum white tiles i can cover with the  k tiles and return the answer after subtracting with the  intital  no of white tiles present in the string.\n\n```\nclass Solution {\npublic:\n    int dp[1001][1001];\n    vector<int>prefix;\n    int helper(int idx,int k,string& floor,int len){\n        if(idx >= floor.size())return 0;\n        if(dp[idx][k] != -1)return dp[idx][k];\n        int op1 = helper(idx + 1,k,floor,len);\n        int op2 = 0;\n        if(floor[idx] == \'1\' && k > 0){\n            int sz = min(idx + len,(int)floor.size());\n            int y = prefix[sz - 1];\n            if(idx - 1 >= 0){\n                y -= prefix[idx - 1];\n            }\n            op2 = y + helper(idx + len,k - 1,floor,len);\n        }\n        return dp[idx][k] = max(op1,op2);\n    }\n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        int cnt = 0;\n        int n = floor.size();\n        memset(dp,-1,sizeof dp);\n        for(int i =0;i<floor.size();i++){\n            if(floor[i] == \'1\')cnt++;\n        }\n        prefix.resize(n + 1,0);\n        prefix[0] = (floor[0] == \'1\');\n        for(int i =1;i<=n;i++){\n            if(floor[i] == \'1\'){\n                prefix[i] = prefix[i - 1] + 1;\n            }\n            else prefix[i] = prefix[i - 1];\n        }\n        if(cnt == 0)return 0;\n        return cnt - helper(0,numCarpets,floor,carpetLen);\n    }\n};\n```
['Dynamic Programming', 'Recursion']