Top-Down and Bottom-Up Approach
Code: Top-Down.\n\nclass Solution { // T.C. -> O (26 * 10 ^ 5 * 2 * 3 * 2) => O (26 * n) (n -> Len of the string),\npublic:          // S.C. -> O (n * 2 * 3 * 2
# Code: Top-Down.\n```\nclass Solution { // T.C. -> O (26 * 10 ^ 5 * 2 * 3 * 2) => O (26 * n) (n -> Len of the string),\npublic:          // S.C. -> O (n * 2 * 3 * 2) => O (n).\n    const int mod = 1e9 + 7;\n\n    long long solve(int index, int l, int e, int t, long long dp[][2][3][2], int n) {\n        if (index == n) {\n            if (l == 1 && e == 2 && t == 1)\n                return 1;\n            \n            return 0;\n        }\n\n        if (dp[index][l][e][t] != -1)\n            return dp[index][l][e][t];\n\n        long long ans = 0;\n\n        for (char ch = \'a\'; ch <= \'z\'; ++ch) {\n            if (ch == \'l\' && l < 1)\n                ans = (ans + solve(index + 1, l + 1, e, t, dp, n)) % mod;\n            else if (ch == \'e\' && e < 2)\n                ans = (ans + solve(index + 1, l, e + 1, t, dp, n)) % mod;\n            else if (ch == \'t\' && t < 1)\n                ans = (ans + solve(index + 1, l, e, t + 1, dp, n)) % mod;\n            else\n                ans = (ans + solve(index + 1, l, e, t, dp, n)) % mod;\n        }\n\n        return dp[index][l][e][t] = ans;\n    }\n\n    int stringCount(int n) {\n        long long dp[100001][2][3][2];\n        memset(dp, -1, sizeof(dp));\n\n        // Index, l cnt, e cnt, t cnt, dp, n.\n        return (int)solve(0, 0, 0, 0, dp, n);\n    }\n};\n```\n\n# Code: Bottom-Up.\n```\n#define ll long long\nconst int mod = 1e9 + 7;\n\nclass Solution { // T.C. -> O (n), S.C. -> O (n).\npublic:\n    int stringCount(int n) {\n        // dp vector initialised with 0\'s.\n        vector<vector<vector<vector<ll>>>> dp(n + 1, vector<vector<vector<ll>>> (2, vector<vector<ll>> (3, vector<ll> (2, 0))));\n\n        // Base Case: One string of len 0 with 0 \'l\', 0 \'e\' and 0 \'t\'.\n        dp[0][0][0][0] = 1;\n\n        // Dynamic Programming to fill the dp vector.\n        for (int i = 0; i < n; ++i) {\n            for (int p = 0; p < 2; ++p) {\n                for (int q = 0; q < 3; ++q) {\n                    for (int r = 0; r < 2; ++r) {\n                        dp[i + 1][p][q][r] = (dp[i + 1][p][q][r] + dp[i][p][q][r] * 23) % mod;\n                        dp[i + 1][min(1, p + 1)][q][r] = (dp[i + 1][min(1, p + 1)][q][r] + dp[i][p][q][r]) % mod;\n                        dp[i + 1][p][min(2, q + 1)][r] = (dp[i + 1][p][min(2, q + 1)][r] + dp[i][p][q][r]) % mod;\n                        dp[i + 1][p][q][min(1, r + 1)] = (dp[i + 1][p][q][min(1, r + 1)] + dp[i][p][q][r]) % mod;\n                    }\n                }\n            }\n        }\n\n        // The result is the count of the strings of length n having 1 \'l\', 2 \'e\' and 1 \'t\'.\n        return (int)dp[n][1][2][1];\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'C++']