Ugliest DP solution, O(n) time and O(1) space
Intuition\n Describe your first thoughts on how to solve this problem. \nCount number of strings, containing "leet" string subcombinations.\n\n# Approach\n Desc
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCount number of strings, containing "leet" string subcombinations.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThere are 12 subcombinations: -, l, le, lee, e, ee, t, te, tee, lt, lte, leet.\nWe could use DP on string prefix to count number of strings of length 0 to n, containing "leet" string subcombinations of lenght 0 to 4 using DP.\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:  \n    int stringCount(int n) {\n        long mod = 1e9 + 7;\n        vector<long> curr(12), prev;\n        // -, l, le, lee, e, ee, t, te, tee, lt, lte, leet\n        // 0  1  2   3    4  5   6  7   8    9   10   11\n        curr[0] = 1;\n        for (int i = 1; i <= n; ++i) {\n            prev = curr;\n            curr[0] = (prev[0] * 23) % mod;\n            curr[1] = (prev[0] + prev[1] * 24) % mod;\n            curr[2] = (prev[1] + prev[4] + prev[2] * 24) % mod;\n            curr[3] = (prev[2] + prev[5] + prev[3] * 25) % mod;\n            curr[4] = (prev[0] + prev[4] * 23) % mod;\n            curr[5] = (prev[4] + prev[5] * 24) % mod;\n            curr[6] = (prev[0] + prev[6] * 24) % mod;\n            curr[7] = (prev[6] + prev[4] + prev[7] * 24) % mod;\n            curr[8] = (prev[7] + prev[5] + prev[8] * 25) % mod;\n            curr[9] = (prev[1] + prev[6] + prev[9] * 25) % mod;\n            curr[10] = (prev[9] + prev[2] + prev[7] + prev[10] * 25) % mod;\n            curr[11] = (prev[3] + prev[8] + prev[10] + prev[11] * 26) % mod;\n        }\n        return curr[11];\n    }\n};\n```
['Dynamic Programming', 'C++']