Classical DP | Memoization | Similiar to 0/1 Knapsack
```\nclass Solution {\npublic:\n    vector pre;\n    int n;\n    vector> dp;\n    int fun(int i,string &f,int nc,int len){\n        \n        if(i >= n) return 
```\nclass Solution {\npublic:\n    vector<int> pre;\n    int n;\n    vector<vector<int>> dp;\n    int fun(int i,string &f,int nc,int len){\n        \n        if(i >= n) return 0;\n        if(nc == 0){\n            return pre[n-1] - (i == 0 ? 0 : pre[i-1]);\n        }\n        if(dp[i][nc] != -1) return dp[i][nc];\n        int left = fun(i+len,f,nc-1,len);\n        int right = (f[i] == \'1\' ? 1 : 0) + fun(i+1,f,nc,len);\n        \n        return dp[i][nc] = min(left,right);\n        \n    }\n    int minimumWhiteTiles(string f, int nc, int len) {\n        \n        n = f.size();\n        pre = vector<int> (n);\n        dp = vector<vector<int>> (n,vector<int> (nc+1,-1));\n        pre[0] = (f[0] == \'1\' ? 1 : 0);\n        for(int i=1;i<n;i++){\n            pre[i] = (f[i] == \'1\' ? 1 : 0) + pre[i-1];\n        }\n        \n        return fun(0,f,nc,len);\n    }\n};
['Dynamic Programming', 'Memoization', 'Prefix Sum']