You roll dice dice, each with faces numbered 1 to faces. Return the number of ways (different sequences of results) that the faces add up to target. Return the answer modulo 10**9 + 7.
For dice = 2, faces = 6 and target = 7 the answer is 6.
The starter code tries every face for every die. It is correct but too slow for many dice.
Example 1
Input:
dice_ways(2, 6, 7)
Output:
6
Example 2
Input:
dice_ways(1, 2, 3)
Output:
0
0 <= dice <= 1001 <= faces <= 600 <= target <= 1000No results yet
Run your code to check it against the examples, or submit to run every test.