Problem · Dynamic Programming
Dice Roll Simulation
Learn this problemProblem statement
Roll a six-sided die exactly n times. Face i + 1 may not appear more than rollMax[i] times consecutively.
Return the number of distinct valid roll sequences modulo 1,000,000,007.
Function
dieSimulator(n: int, rollMax: int[]) → intExamples
Example 1
n = 2rollMax = [1,1,2,2,2,3]return = 34Of the 36 length-two sequences, only 11 and 22 violate their run limits.
Constraints
1 <= n <= 50001 <= rollMax[i] <= 50rollMax.length = 6
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024