C++ - Simple DP Solution
Complexity\n- Time complexity: O(26*n)\n\n- Space complexity: O(n)\n\n# Code\n\nclass Solution {\npublic:\n    \n    const int mod = 1e9 + 7;\n    \n    int dp[
# Complexity\n- Time complexity: $$O(26*n)$$\n\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution {\npublic:\n    \n    const int mod = 1e9 + 7;\n    \n    int dp[100001][2][3][2];\n    \n    int f(int n, int l, int e, int t){\n        if(n == 0){\n            return (l and e >= 2 and t);\n        }\n        if(dp[n][l][e][t] != -1) return dp[n][l][e][t];\n        int ans = 0;\n        for(char i = \'a\'; i <= \'z\'; i++){\n            ans = (1LL*ans + f(n - 1, l or (i == \'l\'), min(e + (i == \'e\'), 2), t or (i == \'t\')))%mod;\n        }\n        return dp[n][l][e][t] = ans;\n    }\n    \n    int stringCount(int n) {\n        memset(dp, -1, sizeof dp);\n        return f(n, 0, 0, 0);\n    }\n};\n```
['Math', 'Dynamic Programming', 'Combinatorics', 'C++']