Simple Solution in Java || Concise and Elegant || With Memoization
\nclass Solution {\n    private int[][] dp;\n    \n    public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {\n        this.dp = new int[fl
```\nclass Solution {\n    private int[][] dp;\n    \n    public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {\n        this.dp = new int[floor.length()+1][numCarpets+1];\n        for(int i=0; i<floor.length(); i++){\n            Arrays.fill(dp[i], -1);\n        }\n        \n        char[] str = floor.toCharArray();\n        return find(0, str, numCarpets, carpetLen);\n    }\n    \n    // Find the minimum number of white tiles visible\n    private int find(int index, char[] floor, int numCarpets, int carpetLen){\n        if(numCarpets < 0) return Integer.MAX_VALUE;\n        if(index >= floor.length) return 0;\n        \n        if(dp[index][numCarpets] != -1){\n            return dp[index][numCarpets];\n        }\n        \n        int min = Integer.MAX_VALUE;\n        // If current tile is black, move to the next\n        if(floor[index] == \'0\'){\n            min = find(index+1, floor, numCarpets, carpetLen);\n        }\n        \n        // If current tile is white, two options, cover the current white tile or not \n        if(floor[index] == \'1\'){\n            min = Math.min(min, find(index + carpetLen, floor, numCarpets - 1, carpetLen));\n            min = Math.min(min, 1 + find(index + 1, floor, numCarpets, carpetLen));\n        }\n        \n        dp[index][numCarpets] = min;\n        return min;\n    }\n}\n```
[]