← Back to Algorithms

0/1 Knapsack

Solves the problem of choosing items with given weights and values to maximize total value while keeping total weight under a limit.

Medium

How it Works

The Knapsack problem involves selecting items with given weights and values to maximize the total value without exceeding the capacity. This algorithm uses a 2D table to store the maximum value that can be obtained with a given capacity and items.