A browser board game rolls dice dice, each with faces numbered 1 to faces. The dice are different colors, so rolling 1 then 6 is different from 6 then 1.
Write countRolls(dice, faces, target) that returns how many rolls add up to exactly target, modulo 1000000007.
Input: dice = 2, faces = 6, target = 7 Output: 6
1+6, 2+5, 3+4, 4+3, 5+2, and 6+1.
Input: dice = 1, faces = 6, target = 3 Output: 1
One die showing 3.
1 <= dice, faces <= 301 <= target <= 1000Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #569 Ways to Roll a Board Game Total. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.