Dice Sum Ways
Roll dice standard six sided dice. Return the number of different outcomes (dice are told apart, so 1 then 2 differs from 2 then 1) whose faces add up to target.
Example 1
dice 2
target 7
returns 6
6 outcomes: 1+6, 2+5, 3+4, 4+3, 5+2, 6+1.
Constraints
1 <= dice <= 61 <= target <= 40
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Dynamic programming problems
- Fairest Stone SplitMedium
- Fewest Perfect SquaresMedium
- Gems That ClashMedium
- Hands That Hit the TargetMedium
- Keystrokes to TransformMedium
- Knight on the KeypadMedium
- Letter DecodingsMedium
- Lightest Deletions to MatchMedium