Different Bottom Up DP approach O(n*6*15)
Here we create 2 dp,\ndp[i][j] -> number of strings of length i ending in j\nsum[i] -> number is strings of length i\nFor calcaulating dp[i][j], we take string 
Here we create 2 dp,\ndp[i][j] -> number of strings of length i ending in j\nsum[i] -> number is strings of length i\nFor calcaulating dp[i][j], we take string by adding 1 to rollmax[j] times j to the end\n\n```\n    int dieSimulator(int n, vector<int>& rollMax) {\n        int m=rollMax.size();\n        vector<vector<ll>> dp(n+1,vector<ll>(m+1,0));\n        vector<ll> sum(n+1,0);\n        sum[0]=1;//one empty string\n        for(int i=1;i<=n;i++){\n            for(int j=0;j<m;j++){\n                //add j at the end 1 to rollmax[j] times\n                for(int k=1;k<=min(rollMax[j],i);k++){\n                    dp[i][j] = (dp[i][j] + sum[i-k]-dp[i-k][j])%mod;\n                    if(dp[i][j]<0)dp[i][j]+=mod;\n                }\n                sum[i]=(sum[i]+dp[i][j])%mod;\n            }\n        }\n        return sum[n];\n    }\n```
['Dynamic Programming', 'C']