Python Deque solution with explanation and comment (456 ms, beat 70.78%)
The basic idea is keeping dp array updated after rolling.\n\nTake n=3, rollMax = [1,1,1,2,2,3] for example.\n\n        # 1   2   3   4     5    6     sum\n     
The basic idea is keeping dp array updated after rolling.\n\nTake n=3, rollMax = [1,1,1,2,2,3] for example.\n\n        # 1   2   3   4     5    6     sum\n        # 1   1   1   1     1    1       6\n        # 5   5   5   1+5   1+5  1+5    33\n        # 28  28  28  5+27  5+27 1+5+27\nFocus on dice 4. \n\nThe first change of dp array is from [1] to [1, 5].\nWe can obtain 5 from using the summation of last roll by deducting the summation of outcomes whose last face is dice 4. Then, 6 - 1 = 5.\n\nThe tricky part is when the most consecutive turns (length of dp[4] (1-indexed)) is equal to the rollMax[2] (0-indexed). In this case, pop out the most left one since it is the outcomes with the most consecutive turns. The dp[4] now is  [5].\n\nThen, append (the summation of last roll - the summation of outcomes whose last face is dice 4) because we want to append the outcomes that dice 4 is in this turn & not on a streak (not appearing in last turn).  So,  dp[4] became [5, 27]. (33 - 6 = 27)\n\n```\nfrom collections import deque\nclass Solution:\n    def dieSimulator(self, n: int, rollMax: List[int]) -> int:\n        # summation array keeps sum of each roll e.g summation[1] == sum of first roll\n        summation = [0]\n        \n        # dp records consecutive counts, updated each roll\n        # Take dp[2] = [1, 5, 27] for example.\n        # It means we get dice 2 three consecutive turn 1 time, dice 2 two consecutive turn 5 times and dice 2 this turn only 27 times.\n        dp = [deque([]) for _ in range(7)]\n        for i in range(1, 7):\n            dp[i].append(1)\n        summation.append(6)\n       \n        for roll in range(2, n+1):\n            last_roll_sum = summation[-1]\n            current_roll_sum = 0\n            for i in range(1, 7):\n                last_dice_sum = sum(dp[i])\n                # if the length of dp[i] >= rollMax[i-1]\n                # pop out the most left one since it get the most consecutive turn, and shouldn\'t keep rolling.\n                if len(dp[i]) == rollMax[i-1]:\n                    dp[i].popleft()\n                # last_roll_sum - last_dice_sum == last roll doesn\'t end with i, so append to dp[i]. note: dp[i][-1] == get dice i not on a streak.\n                dp[i].append(last_roll_sum - last_dice_sum)\n                \n                # summing up dp[1] to dp[6] \n                current_roll_sum += sum(dp[i])\n                \n            # append sum of the most recent roll \n            summation.append(current_roll_sum)\n        return summation[n] % (10**9+7)\n```\n\t\n\t
['Queue', 'Python']