Knapsack problem/Bounded

FCC link

The bounded knapsack problem is defined as follows:

You are given an array of objects representing items to be put in a knapsack. The objects have 4 attributes: name, pieces (the number of the particular item), weight, and value. The items need to be selected so that the total weight does not exceed the maximum weight and the value is maximized. Keep in mind that each item can appear between 0 and pieces times.

Test

{{test}}

Console output