Question
SumCraft
Given an array of distinct integers nums and a target integer target, return a list of all unique combinations of nums where the chosen numbers sum to target. You may return the combinations in any order.
The same number may be chosen from nums an unlimited number of times. Two combinations are unique if the frequency of at least one of the chosen numbers is different.
The test cases are generated such that the number of unique combinations that sum up to target is less than 150 combinations for the given input.
Input
User Task
Since this is a functional problem, you don't have to input anything. You just need to complete the combinationSum(nums, target) function that takes array nums and target as input

Custom Input
The first line contains an integer n length of nums.
The next line contains n space-separated integers as input representing the nums .
The third line contains an integer representing target

Output
Return all the possible combinations that add up to target in any order.
Example
Input:
3
1 2 3
3
Output:
[[1,1,1], [1,2], [3]]

Online