Python easy peasy recursion + memoization
```\ndef dieSimulator(self, n: int, rollMax: List[int]) -> int:\n        from functools import lru_cache\n        \n        @lru_cache(None)\n        def helper
```\ndef dieSimulator(self, n: int, rollMax: List[int]) -> int:\n        from functools import lru_cache\n        \n        @lru_cache(None)\n        def helper(last, times, n):\n            \n            if n==1:\n                if last==None:\n                    return 6\n                else:\n                    if rollMax[last-1] == times:\n                        return 5\n                    return 6\n                \n            \n            \n            ans  = 0\n            for f in range(1, 7):\n                if last!=None:\n                    if f==last and times == rollMax[f-1]:\n                        pass\n                    elif f==last:\n                        ans += helper(f, times+1, n-1)\n                        ans %= (10**9+7)\n                    else:\n                        ans += helper(f, 1, n-1)\n                        ans %= (10**9+7)\n                else:\n                    ans += helper(f, 1, n-1)\n                    ans %= (10**9+7)\n            \n            return ans\n        \n        return helper(None, 0, n)
['Recursion', 'Memoization', 'Python3']