Python 3 | DFS + Memoization | Explanation
Intuition\n- Given n chances, for each dice side (1 to 6), do a roll\n- Then you have n-1 chances, repeat previous step, until you have no chance meaning this i
### Intuition\n- Given `n` chances, for each dice side (1 to 6), do a roll\n- Then you have `n-1` chances, repeat previous step, until you have no chance meaning this is a possible combination, so `if not n: return 1`\n- Keep track of repeat numbers, `k` meaning how many times a number is repeated\n\t- If the new dice number is different from previous round, then `k=1`\n\t- If they are the same and `k+1 <= rollMax[j]` (or `k+1 <= rollMax[i]`, doesn\'t matter since `i == j`)\n\t- Other combinations are not valid, so ignore\n\t\n### Implementation\n```\nclass Solution:\n    def dieSimulator(self, n: int, rollMax: List[int]) -> int:\n        @lru_cache(maxsize=None)\n        def dfs(n, i, k):\n            if not n: return 1\n            ans = 0\n            for j in range(6):\n                if i != j: ans += dfs(n-1, j, 1)\n                elif k+1 <= rollMax[j]: ans += dfs(n-1, j, k+1)\n            return ans    \n        return sum(dfs(n-1, i, 1) for i in range(6)) % 1000000007\n```
['Memoization', 'Python', 'Python3']