✅[Java] || Using dynamic programming || Simple Solution
First, if numCarpets * carpetLen > floor.size(), the answer is always 0 because the entire floor can be covered.\nOtherwise,This problem can be solved by using 
First, if numCarpets * carpetLen > floor.size(), the answer is always 0 because the entire floor can be covered.\nOtherwise,This problem can be solved by using dynamic programming.\nThe variables in the DP are\n1. length of confirmed Floor (starting from the left end at 0)\n2. number of carpets used\n\nThe spatial computational complexity of a 2-dimensional array using the above variables is O(1e6).\n\nPlease see the image below for a sample transition with floor = "10110", numCarpets = 2, carpetLen = 2.\n![image](https://assets.leetcode.com/users/images/20a2a6f5-af47-40d4-a972-6e2e000d96e3_1647710851.003477.png)\n\nThe red arrow shows the transition when the carpet is pulled.\n`dp[i+cl][j+1] = Math.min(dp[i+cl][j+1], dp[i][j]);`\n\u203B Math.min(i+cl,f.length) is used in my code because the index could exceed floor.size().\n\nThe black arrow is the transition if the carpet is not pulled.\nIf the next floor is white, increase the value by +1 from the current value.\n`dp[i+1][j] = Math.min(dp[i+1][j], dp[i][j] + floor[i]);`\n\nWe have solved this problem by performing two different transitions for each item in the dp array.\n\nex) the gray items and arrows are not valid, we can show that there is no transition from dp[0][0] to dp[1][0],dp[1][1] for example, because the length of the carpet is more than 2.\n\n```\nclass Solution {\n    public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {\n        //1. Redefine for variable name shortening\n        int ln = floor.length();\n        int nc = numCarpets;\n        int cl = carpetLen;\n        \n        //2. Return 0 if all floors can be covered from carpet length * number of carpets.\n        char[] f = floor.toCharArray();\n        int cover = numCarpets * carpetLen;\n        if(cover >= f.length) return 0;\n        \n        \n        //3. Dynamic Programming\n        int[][] dp = new int[ln+1][nc+1];\n        for(int i = 0; i <= ln; i++) Arrays.fill(dp[i],f.length);\n        dp[0][0] = 0;\n        for(int i = 0; i < ln; i++){\n            int plus = f[i]-\'0\';\n            for(int j = 0; j <= nc; j++){\n                dp[i+1][j] = Math.min(dp[i+1][j],dp[i][j] + plus);\n                if(j != nc) dp[Math.min(i+cl,f.length)][j+1] = Math.min(dp[Math.min(i+cl,f.length)][j+1], dp[i][j]);\n            }\n        }\n        return dp[ln][nc];\n    }\n}\n```
[]