Why my bottom-up code is giving TLE?
\nclass Solution {\npublic:\n    // int memo(int i, int j, vector<int>& pref, int cl,\n    //          vector<vector<int>>& dp)\n    // {\n    //     if(i >= pr
```\nclass Solution {\npublic:\n    // int memo(int i, int j, vector<int>& pref, int cl,\n    //          vector<vector<int>>& dp)\n    // {\n    //     if(i >= pref.size() || j <= 0)\n    //         return 0;\n    //     if(dp[i][j] != -1)\n    //         return dp[i][j];\n    //     else\n    //     {\n    //         dp[i][j] = max(memo(i+cl, j-1, pref, cl, dp)\n    //                        + pref[i], \n    //                        memo(i+1, j, pref, cl, dp));\n    //     }\n    //     return dp[i][j];\n    // }\n    int minimumWhiteTiles(string& f, int n, int cl) {\n        vector<vector<int>> dp(1001, vector<int>(1001, -1));\n        int tot = 0;\n        for(auto x : f)\n            if(x == \'1\')\n                tot++;\n        vector<int> pref(f.size(), 0);\n        int x = f.size() - 1;\n        for(int i = 0; i < cl; i++, x--)\n        {\n            if(x < f.size() - 1)\n                pref[x] = pref[x+1];\n            if(f[x] == \'1\')\n                pref[x]++;\n        }\n        int y = f.size() - 1;\n        while(x >= 0)\n        {\n            pref[x] = pref[x+1];\n            if(f[y] == \'1\')\n                pref[x]--;\n            if(f[x] == \'1\')\n                pref[x]++;\n            x--;\n            y--;\n        }\n        for(int i = 0; i <= f.size(); i++)\n            dp[i][0] = 0;\n        for(int j = 0; j <= n; j++)\n            dp[f.size()][j] = 0;\n        for(int i = f.size()-1; i >= 0; i--)\n        {\n            for(int j = 1; j <= n; j++)\n            {\n                dp[i][j] = max(dp[i+1][j],\n                               dp[min(i+cl,int(f.size()-1))][j-1]\n                               + pref[i]);\n            }\n        }\n        return tot > dp[0][n] ? tot - dp[0][n] : 0;\n    }\n};\n\n```
['Dynamic Programming', 'Memoization', 'C']