Given an array nums of distinct positive integers and a target, return the number of sequences of numbers from nums (each number may be used any number of times) that add up to target. Different orders count as different sequences, so [1, 2] and [2, 1] are two answers.
- The answer fits in a JavaScript safe integer for the inputs used here
- An empty target of
0 has exactly one sequence, the empty one - This is the Coin Change II lesson from the chapter, with the loops the other way round
- Target complexity: O(target · nums.length) time, O(target) space