C++ || 0/1 knapsack
\nclass Solution {\nprivate:\n    int dp[1001][1001];\n    int solve(string& floor,int idx,int n,int car,int len,vector<int>&prefix)\n    {\n        if(idx==n |
```\nclass Solution {\nprivate:\n    int dp[1001][1001];\n    int solve(string& floor,int idx,int n,int car,int len,vector<int>&prefix)\n    {\n        if(idx==n || car==0)\n            return 0;\n        \n        if(dp[idx][car]!=-1)\n            return dp[idx][car];\n        \n        int range=min(idx+len-1,n-1);\n        int cnt=prefix[range];\n        \n        if(idx>0)\n            cnt-=prefix[idx-1];\n        \n        int pick=cnt+solve(floor,min(idx+len,n),n,car-1,len,prefix);\n        int skip=solve(floor,idx+1,n,car,len,prefix);\n        return dp[idx][car]=max(pick,skip);\n    }\npublic:\n    int minimumWhiteTiles(string floor, int Carpet, int carpetLen) {       \n        \n        memset(dp,-1,sizeof dp);\n        int n=floor.size();\n        vector<int>prefix(n,0);\n        int cnt=0;\n        for(auto i=0;i<n;++i)\n        {\n            if(floor[i]==\'1\')\n                cnt++;\n            \n            prefix[i]=cnt;\n        \n        }\n        return cnt-solve(floor,0,floor.size(),Carpet,carpetLen,prefix);\n        \n    }\n};\n```
['Dynamic Programming', 'Memoization', 'C']