← Back

Unbounded Knapsack

Unlimited copies of each item allowed.

dpknapsackUpdated 2025-09-01

Transition

  • dp[w] = max(dp[w], val + dp[w - wt])

Order

  • Iterate weights ascending allows reuse