• + 1 comment

    To create the sum, use any element of your array zero or more times.

    For example, if arr=[2,3,4] and your target sum is 10 , you might select [2,2,2,2,2], [2,2,3,3] or [3,3,3,1] . In this case, you can arrive at exactly the target.

    But how is he using 1 in last array ([3,3,3,1])? It's not in [2,3,4]. The problem statement doesn't include allowance of other numbers and does it make sense even?