0/1 Knapsack

medium
Unit 11 · Dynamic Programming I0/2 to milestone

You have items with weights and values and a bag with a weight capacity. Each item can be taken at most once. Maximise the total value.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
0/1 Knapsack · TechGradify