0/1 Knapsack Problem

Hard

📝 Description

Maximize value in knapsack without exceeding weight capacity

Input Format

weights[], values[], capacity

Output Format

maximum value

Constraints

1 ≤ n ≤ 100, 1 ≤ capacity ≤ 10^4

🔍 Sample Input

[1,2,3], [10,15,40], 5
            

✅ Sample Output

55
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run