We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Knapsack
You are viewing a single comment's thread. Return to all comments →
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?