DP 3d Memoization
\n    long long mod = 1e9+7 ;\n    vector >> dp ;\n    long long helper(int i,int prev,int cnt,vector &nums)\n    {\n        if(i==0)return 1 ;\n        if(dp[i
\n    long long mod = 1e9+7 ;\n    vector <vector <vector <long long >>> dp ;\n    long long helper(int i,int prev,int cnt,vector <int>&nums)\n    {\n        if(i==0)return 1 ;\n        if(dp[i][prev][cnt]!=-1)return dp[i][prev][cnt] ;\n        long long ans=0 ;\n        for(int j=1;j<=6;j++)\n        {\n            if(j==prev)\n            {\n                if(cnt<nums[prev-1])\n                {\n                     ans=((ans%mod)+(helper(i-1,j,cnt+1,nums)%mod))%mod ;\n                }\n            }\n            else\n            {\n                ans=((ans%mod)+(helper(i-1,j,1,nums)%mod))%mod ;\n            }\n        }\n        return dp[i][prev][cnt]=ans ;\n    }\n    int dieSimulator(int n, vector<int>& rollMax) {\n        if(n==1)return 6 ;\n        long long ans = 0 ;\n        dp.resize(n,vector <vector <long long>> (7,vector <long long> (16,-1))) ;\n        for(int i=1;i<=6;i++)\n        {\n            ans=((ans%mod)+(helper(n-1,i,1,rollMax)%mod))%mod ;\n        }\n        return (int)ans ;\n    }
['Dynamic Programming', 'Memoization', 'C']