4d dp❌ 3d dp✅
Intuition\ndp solution\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\
# Intuition\ndp solution\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n```\nclass Solution {\npublic:\n    int mod =1e9+7;\n    int solve(int n,int count,int e,vector<vector<vector<int>>>&dp){\n        if(n==0){\n            if(count+e==0){\n                return 1;\n            }\n            return 0;\n        }\n        if(dp[n][count][e]!=-1)return dp[n][count][e];\n        int ans=0;\n        if(count +e>0){\n            if(e)ans=ans+solve(n-1,count,e-1,dp)%mod;\n            if(count)ans=ans+solve(n-1,count-1,e,dp)*count%mod;\n        }\n        int a=0;\n        if(e )a=1;\n        ans=(ans+(long long)solve(n-1,count,e,dp)*(26-a-count))%mod;\n        return dp[n][count][e]= ans%mod;\n    }\n    int stringCount(int n) {\n        vector<vector<vector<int>>>dp(n+1,vector<vector<int>>(3,vector<int>(3,-1)));\n        return solve(n,2,2,dp);\n    }\n};\n```
['C++']