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.
I think this problem needs more clarification. For example, the first test case with a sum of 12 can be solved in 3 ways:
A). twelve 1s B). two 6s C). one 9 and three 1s
The unbounded knapsack problem tries to maximize the value of the objects placed into the knapsack. In this problem, there are no values for the objects, so there needs to be an additional phrase along the lines of "minimize the # of numbers used".
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 →
I think this problem needs more clarification. For example, the first test case with a sum of 12 can be solved in 3 ways:
A). twelve 1s B). two 6s C). one 9 and three 1s
The unbounded knapsack problem tries to maximize the value of the objects placed into the knapsack. In this problem, there are no values for the objects, so there needs to be an additional phrase along the lines of "minimize the # of numbers used".