← All problemsSign in

Profit Maximization

Problem description. We have ‘N’ items each of type Tp[i] where Tp[i] is from 1 to k. Each item has a profit P[i] associated with it. We also have an array M[] containing 'k' elements : M[1] , M[2] .... , M[k]. We have to select some items from all N items such that : - For two selected items 'i' and 'j' => P[i] != P[j] - Number of selected items from a given type ‘j’ is Note that two items ha

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