You are given a list of different positive numbers candidates and a number target. Find every way to pick numbers from candidates so that the picked numbers add up to target.
You can pick the same number as many times as you like. Two ways are different if some number is picked a different number of times. Return all the ways, in any order.
Examples
Example 1:
Input: candidates = [2,4,5], target = 9
Output: [[2,2,5],[4,5]]
Explanation: 2 + 2 + 5 = 9 and 4 + 5 = 9. There are no other ways.
Example 2:
Input: candidates = [3,4,7], target = 10
Output: [[3,3,4],[3,7]]
Explanation: 3 + 3 + 4 = 10 and 3 + 7 = 10.
Example 3:
Input: candidates = [7,9], target = 5
Output: []
Explanation: Both numbers are bigger than 5, so no way exists.