Simple Memoization based solution
Approach\nThree choices\n1. Use carpet if available and necessary. In this can case jump to index + carpet length\n2. Do not use carpet even if available and ne
# Approach\nThree choices\n1. Use carpet if available and necessary. In this can case jump to index + carpet length\n2. Do not use carpet even if available and necessary. Increase count by 1 and move to next index. Here we save carpt to be used later. \n3. Handle scenarios like no carpet available or carpet not necessary because tile is lready black. \n\n\n# Complexity\n- Time complexity: $$O(floorLength * numberOfCarpets)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(floorLength * numberOfCarpets)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {\n        int[][] memo = new int[floor.length()][numCarpets+1];\n        for(int[] arr : memo) {\n            Arrays.fill(arr, -1);\n        }\n        return solve(floor, numCarpets, carpetLen, 0, memo);\n    }\n\n    int solve(String floor, int numCarpets, int carpetLen, int index, int[][] memo) {\n        if(index >= floor.length()) {\n            return 0;\n        }\n        if(memo[index][numCarpets] != -1) {\n            return memo[index][numCarpets];\n        }\n        if(numCarpets > 0) {\n            if(floor.charAt(index) == \'0\') {\n                return memo[index][numCarpets] = solve(floor, numCarpets, carpetLen, index+1, memo);\n            }\n            else {\n                int coveredWhite = solve(floor, numCarpets-1, carpetLen, index+carpetLen, memo);\n                int unCoveredWhite = 1 + solve(floor, numCarpets, carpetLen, index+1, memo);\n                return memo[index][numCarpets] = Math.min(coveredWhite, unCoveredWhite);\n            }\n        }\n        else {\n            int count = 0;\n            for(int i = index; i < floor.length(); i++) {\n                count = floor.charAt(i) == \'1\' ? count + 1 : count;\n            }\n            return memo[index][numCarpets] = count;\n        }\n    }\n}\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Java']