DP || C++
\n\n# Code\n\nclass Solution {\npublic:\n    int dp[1001][1001];\n    int nerd(int index,int used,int total,int len,vector<int>&v){\n        if(index>=v.size() 
\n\n# Code\n```\nclass Solution {\npublic:\n    int dp[1001][1001];\n    int nerd(int index,int used,int total,int len,vector<int>&v){\n        if(index>=v.size() or used==total) return 0;\n        if(dp[index][used]!=-1) return dp[index][used];\n        int notusing=nerd(index+1,used,total,len,v);\n        int usingt=nerd(index+len,used+1,total,len,v);\n        int wscovered;\n        if(index>0) wscovered=v[index-1];\n        else wscovered=0;\n        if(index+len>=v.size()) wscovered=v[v.size()-1]-wscovered;\n        else wscovered=v[index+len-1]-wscovered;\n        return dp[index][used]=max(wscovered+usingt,notusing);\n    }\n    int minimumWhiteTiles(string s, int n, int l) {\n        if(s.size()<=n*l) return 0;\n        memset(dp,-1,sizeof(dp));\n        vector<int>v(s.size());\n        for(int i=0;i<s.size();i++) v[i]=s[i]-\'0\';\n        for(int i=1;i<s.size();i++) v[i]+=v[i-1];\n        return v[v.size()-1]-nerd(0,0,n,l,v);\n    }\n};\n```
['Dynamic Programming', 'C++']