131: Dice roll sum

Given a number of dice to roll and a target sum of all die values, return all combinations of die value that add up to the given sum

Note: dice values [1- 6]

 

Example 1

Input:   diceCount = 1, sum = 3

Output:  [[3]]

Example 2

Input:   diceCount = 2, sum = 7

Output:  [[1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]]
Difficulty:Medium
Topic:Backtracking
Problem #:131