All challenges
Multiple ChoiceHard 30s

0/1 Knapsack

The 0/1 Knapsack problem: given items with weight and value, maximize value without exceeding capacity. Solved with DP in:
Options
  1. 1O(2^n) time by trying every subset
  2. 2O(n) time scanning the items once
  3. 3O(n·W) time where n=items, W=capacity
  4. 4O(n log n) time after sorting items

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle