No Math Required -> Basic Recursion + Memoization !
Intuition\nWe only need two \'e\', one \'l\' and one \'t\' to form a required string. Any string having these can be rearranged to have "leet" as a substring in
# Intuition\nWe only need two \'e\', one \'l\' and one \'t\' to form a required string. Any string having these can be rearranged to have "leet" as a substring in it.\n\n# Approach\nSuppose we have an empty array and we need to fill this array using some characters. For filling this imaginary array, I am taking an \'index\' variable. \n\nFor every index, we can fill the index using any character from \'a\' to \'z\'. If we fill it using \'e\', then we increment our e counter. Similarily, for \'l\' and \'t\'. \n\nOnce the count of e reaches 2, we don\'t need to increment it further since any greater count will not affect our answer. Making this condition is necessary because otherwise the value of e,l or t can reach upto 10^5 and will give memory limit exceeded error. \n\nOnce our index reaches the end, if our e, l and t have 2,1,1 values, the string is good and we can include it in our answer.\n\nIf you are a beginner and do not understand anything written above, please go and understand the problem [Coin Change](https://leetcode.com/problems/coin-change-ii/description/) and then try to understand this problem.\n\nSimilar Problem : [1220. Count Vowels Permutation](https://leetcode.com/problems/count-vowels-permutation/description/?envType=daily-question&envId=2023-10-28)\n\n# Complexity\n- Time complexity:\nO(n*26)\n\n- Space complexity:\nO(n*26)\n\n# Code\n```\nclass Solution {\npublic:\n    long long mod= 1e9+7;\n    long long dp[100001][3][2][2];\n    long long find(int index, int n, int e, int l, int t){\n        if(index==n){\n            //If the criteria is met, then return 1 else return 0\n\n            if(e>=2 && l>=1 && t>=1)return 1;\n            else return 0;\n        }\n\n        //If we have a precomputed answer\n        if(dp[index][e][l][t]!=-1)return dp[index][e][l][t];\n\n        //Initializing variable as zero\n        long long pick=0;\n\n        //Checking out each possibility from \'a\' to \'z\' with a loop\n        for(int i=0;i<26;i++){\n\n            if(i==4 && e<2){\n                //If we encounter an \'e\' and the variable has value less than 2, then increment it.\n\n                pick= (pick +find(index+1,n,e+1,l,t))%mod;\n            }\n\n            else if(i==11 && l<1){\n                //If we encounter an \'l\' and the variable has value less than 1, then increment it.\n\n                pick= (pick +find(index+1,n,e,l+1,t))%mod;\n            }\n            else if(i==19 && t<1){\n                //If we encounter an \'t\' and the variable has value less than 1, then increment it.\n\n                pick= (pick +find(index+1,n,e,l,t+1))%mod;\n            }\n            //Otherwise, just loop forward adding this possibility of i.\n            else pick= (pick +find(index+1,n,e,l,t))%mod;\n            \n        }\n\n        //Finally return the sum of all valid possibilities\n        return dp[index][e][l][t] = pick;\n        \n    }\n    int stringCount(int n) {\n        memset(dp,-1,sizeof(dp));\n        return (int)(find(0,n,0,0,0)%mod);\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'C++']