FunctionRacerProblemsRace

Dice Sum Ways

MediumDynamic programmingPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Dynamic programming problems