Beginner Friendly || Recursion with Memoization
```\n int mod = 1e9+7;\n    //RECURSION  :\n    //TLE\n    int solve1(int n,int prev,int cnt,vector& rollMax)\n    {\n        if(n == 0)\n            return 1;\
```\n int mod = 1e9+7;\n    //RECURSION  :\n    //TLE\n    int solve1(int n,int prev,int cnt,vector<int>& rollMax)\n    {\n        if(n == 0)\n            return 1;\n        int ans=0;\n        for(int i=1;i<=6;i++)\n        {\n            if(i == prev && cnt >= rollMax[i-1])\n                continue;\n            if(i==prev)\n              ans = (ans + solve1(n-1,i,cnt+1,rollMax))%mod;\n            else\n              ans = (ans + solve1(n-1,i,1,rollMax))%mod; \n        }\n        return ans;\n    }\n    //RECURSION WITH MEMOIZATION\n    int solve(int n,int prev,int cnt,vector<int>& rollMax, vector<vector<vector<int>>>&dp)\n    {\n        if(n == 0)\n            return 1;\n        int ans=0;\n        if(prev != -1)\n        {\n        if(dp[n][prev][cnt] != -1)\n            return dp[n][prev][cnt];\n        }\n        for(int i=1;i<=6;i++)\n        {\n            if(i == prev && cnt >= rollMax[i-1])\n                continue;\n            if(i==prev)\n              ans = (ans + solve(n-1,i,cnt+1,rollMax,dp))%mod;\n            else\n              ans = (ans + solve(n-1,i,1,rollMax,dp))%mod; \n        }\n        if(prev != -1)\n        dp[n][prev][cnt] = ans;\n        return ans;\n    }\n    int dieSimulator(int n, vector<int>& rollMax) {\n        //return solve1(n,-1,0,rollMax)%mod;\n        vector<vector<vector<int>>>dp(n+1,vector<vector<int>>(7,vector<int>(20,-1)));\n        return solve(n,-1,0,rollMax,dp)%mod;\n    }
['Dynamic Programming', 'Recursion', 'Memoization', 'C']