[C++] Simple C++ Code
If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n    int d
# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    int dfs(string &floor, int Carpets, int Len, int idx, vector<vector<int>> &dp)\n    {\n        if(idx >= floor.size())\n            return 0;\n        int val = 0;\n        if(dp[idx][Carpets] != -1) return dp[idx][Carpets];\n        if(Carpets == 0)\n        {\n            for(int i = idx; i < floor.size(); i++)\n                if(floor[i] == \'1\') val++;\n        }\n        else\n        {\n            if(floor[idx] == \'0\')\n                val = dfs(floor, Carpets, Len, idx+1, dp);\n            else\n            {\n                val = min(1+dfs(floor, Carpets, Len, idx+1, dp), dfs(floor, Carpets-1, Len, idx+Len, dp));\n            }\n        }\n        return dp[idx][Carpets] = val;\n    }\npublic:\n    int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n        int n = floor.size();\n        vector<vector<int>> dp(n+1, vector<int> (numCarpets+1, -1));\n        return dfs(floor, numCarpets, carpetLen, 0, dp);\n    }\n};\n```
['Dynamic Programming', 'Memoization', 'C', 'C++']