← All problemsSign in

Knapsack Problem

CodeChefRating 2239Open on judge ↗

Mike takes part in programming contests. His favourite topic is dynamic programming(DP). As he said, that he likes problems on DP, because "you spend a lot of time on thinking and a little time on coding". In this problem you are to solve a version of the knapsack problem(link), one of the most famous examples of DP problem. You are given N items, each has two parameters: a weight and a cost. Le

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start