Knapsack
CodeChefOpen on judge ↗
Chef is having a Knapsack which contains Mangoes of different weight. Let’s take an array knap[] of size $N$ which contains {$knap[0]$, $knap[1]$, ………….., $knap[n-1]$} , where $knap[i]$ denotes the weight of a mango $i$. Also, he wants to sell all these mangoes by packing all those in different Carry bag. The number of mangoes each Carry bag can hold is given in $cb[]$ array of size $M$. $cb[i]$
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.
Sign in to chat with the tutor and save your progress.
Sign in to start