Exercises/#54 0/1 Knapsack
#54

0/1 Knapsack

Medium🧩 Dynamic Programming
100 XP

Problem

Given weights and values of n items and a knapsack capacity W, find the maximum value you can put in the knapsack.

Examples

Input: weights=[1,3,4,5], values=[1,4,5,7], W=7
Output: 9 (items 2+3 with weight 3+4=7)
dynamic-programmingknapsack
AI Assistantβ€” powered by AI

Unlock hints progressively β€” start gentle, go deeper only if needed.

πŸ’‘

Level 1: Gentle Nudge

A subtle direction

πŸ—ΊοΈ

Level 2: Approach

The algorithm to use

πŸ”

Level 3: Detailed

Step-by-step guidance

54 / 150

Your Solution

⚑ JavaScript

to save progress and use AI features