Java DP with all the cases and comments. Making a hard question to medium.
Intuition\n Describe your first thoughts on how to solve this problem. \nFor any string, we can have 12 status:\n0 -> null, 1 -> l, 2 -> t, 3 -> e, 4 -> lt, 5 -
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFor any string, we can have 12 status:\n0 -> null, 1 -> l, 2 -> t, 3 -> e, 4 -> lt, 5 -> le, 6 -> te, 7 -> ee, 8 -> lte, 9 -> lee, 10 -> tee, 11 -> ltee\nThe status means the string containing the letters.\nOne stauts can become another by adding one letter.\nFor example, "aa" belongs to 0. We add a "b" after it. The new string "aab" also belongs to 0.\nIf we add "l" to it, "aal" belongs to 1. \n# Approach\n<!-- Describe your approach to solving the problem. -->\nSo, \n// 0 -> 0, 1, 2, 3\n// 1 -> 1, 4, 5\n// 2 -> 2, 4, 6\n// 3 -> 3, 5, 6, 7\n// 4 -> 4, 8\n// 5 -> 5, 8, 9\n// 6 -> 6, 8, 10\n// 7 -> 7, 9, 10\n// 8 -> 8, 11\n// 9 -> 9, 11\n// 10 -> 10, 11\n// 11 -> 11\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(12 * n) -> O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(12) -> O(1)\n\n# Code\n```\nclass Solution {\n    public int stringCount(int n) {\n        if (n < 4) return 0;\n        // 0 -> null, 1 -> l, 2 -> t, 3 -> e, 4 -> lt, 5 -> le, 6 -> te, 7 -> ee, 8 -> lte, 9 -> lee, 10 -> tee, 11 -> ltee\n        long dp[] = new long[12], MOD = 1_000_000_007;\n        dp[0] = 23;\n        dp[1] = dp[2] = dp[3] = 1;\n\n        for (int i = 1; i < n; ++i) {\n            long dp2[] = new long[12];\n            // 0 -> 0, 1, 2, 3\n            dp2[0] = (dp2[0] + dp[0] * 23) % MOD;\n            dp2[1] = (dp2[1] + dp[0] * 1) % MOD;\n            dp2[2] = (dp2[2] + dp[0] * 1) % MOD;\n            dp2[3] = (dp2[3] + dp[0] * 1) % MOD;\n            // 1 -> 1, 4, 5\n            dp2[1] = (dp2[1] + dp[1] * 24) % MOD;\n            dp2[4] = (dp2[4] + dp[1] * 1) % MOD;\n            dp2[5] = (dp2[5] + dp[1] * 1) % MOD;\n            // 2 -> 2, 4, 6\n            dp2[2] = (dp2[2] + dp[2] * 24) % MOD;\n            dp2[4] = (dp2[4] + dp[2] * 1) % MOD;\n            dp2[6] = (dp2[6] + dp[2] * 1) % MOD;\n            // 3 -> 3, 5, 6, 7\n            dp2[3] = (dp2[3] + dp[3] * 23) % MOD;\n            dp2[5] = (dp2[5] + dp[3] * 1) % MOD;\n            dp2[6] = (dp2[6] + dp[3] * 1) % MOD;\n            dp2[7] = (dp2[7] + dp[3] * 1) % MOD;\n            // 4 -> 4, 8\n            dp2[4] = (dp2[4] + dp[4] * 25) % MOD;\n            dp2[8] = (dp2[8] + dp[4] * 1) % MOD;\n            // 5 -> 5, 8, 9\n            dp2[5] = (dp2[5] + dp[5] * 24) % MOD;\n            dp2[8] = (dp2[8] + dp[5] * 1) % MOD;\n            dp2[9] = (dp2[9] + dp[5] * 1) % MOD;\n            // 6 -> 6, 8, 10\n            dp2[6] = (dp2[6] + dp[6] * 24) % MOD;\n            dp2[8] = (dp2[8] + dp[6] * 1) % MOD;\n            dp2[10] = (dp2[10] + dp[6] * 1) % MOD;\n            // 7 -> 7, 9, 10\n            dp2[7] = (dp2[7] + dp[7] * 24) % MOD;\n            dp2[9] = (dp2[9] + dp[7] * 1) % MOD;\n            dp2[10] = (dp2[10] + dp[7] * 1) % MOD;\n            // 8 -> 8, 11\n            dp2[8] = (dp2[8] + dp[8] * 25) % MOD;\n            dp2[11] = (dp2[11] + dp[8] * 1) % MOD;\n            // 9 -> 9, 11\n            dp2[9] = (dp2[9] + dp[9] * 25) % MOD;\n            dp2[11] = (dp2[11] + dp[9] * 1) % MOD;\n            // 10 -> 10, 11\n            dp2[10] = (dp2[10] + dp[10] * 25) % MOD;\n            dp2[11] = (dp2[11] + dp[10] * 1) % MOD;\n            // 11 -> 11\n            dp2[11] = (dp2[11] + dp[11] * 26) % MOD;\n\n            dp = dp2;\n        }\n\n        return (int)(dp[11]);\n    }\n}\n```
['Java']