Poly Knapsack
You are given two lists of integers weights
and values
which have the same length and an integer capacity
. weights[i]
and values[i]
represent the weight and value of the i
th item.
Given that you can take at most capacity
weights, and that you can take any number of copies for each item, return the maximum amount of value you can get.
Constraints
n ≤ 250
wheren
is the length ofweights
andvalues
capacity ≤ 250
https://binarysearch.com/problems/Poly-Knapsack
Examples
Example 1
Input
- weights =
[1, 2, 3]
- values =
[1, 5, 3]
- capacity =
5
Output
- answer =
11
Leave a comment