C++ Dynamic Programing Solution | Time-O(n^2), Space- O(n)
\nclass Solution {\npublic:\n    int minimumWhiteTiles(string a, int n, int k) {\n        \n        int m= a.size();\n        \n        vector<int> v(m+1,0),h;\
```\nclass Solution {\npublic:\n    int minimumWhiteTiles(string a, int n, int k) {\n        \n        int m= a.size();\n        \n        vector<int> v(m+1,0),h;\n        \n        v[0] = 0;\n        \n        for(int i=1;i<=m;i++)\n        {\n            v[i] = v[i-1];\n            if(a[i-1]==\'1\')\n                v[i]++;\n        }\n        \n        for(int i=1;i<=n;i++)\n        {\n            h = v;\n            v[0] = 0;\n            for(int j=1;j<=m;j++)\n            {\n                if(a[j-1]==\'1\')\n                {   \n                    if(j>=k)\n                        v[j] = min(h[j-k],v[j-1]+1);\n                    else\n                        v[j] = 0;\n                }\n                else\n                    v[j] = v[j-1];\n            }\n        } \n        \n        return v[m];\n         \n    }\n};\n```
[]