Number of Dice Rolls With Target Sum
Problem statement
Roll dice identical dice, each with faces numbered from 1 through faces. Return the number of ordered outcomes whose sum equals target, modulo 1,000,000,007.
Function
numRollsToTarget(dice: int, faces: int, target: int) → intExamples
Example 1
dice = 2faces = 6target = 7return = 6The ordered pairs are (1,6) through (6,1).
Constraints
1 <= dice, faces <= 30.1 <= target <= 1000.