Intern | Please Help With This DP Question.
Anonymous User
817

I was giving Hackerearth problem setter Intern test where this question had appeared. Can anyone tell me Recursion+Memoization approach to it?

Question:
There are N elements given which have their own Type, Weight, Profit. You are given Capacity K. You had to find maximum Profit under the condition that you are allowed to pick only one item of a type i.e. if you pick one item of type 1 you cannot pick other item of type-1 again.

Test Case:
N=6,
1 3 13
5 1 10
2 2 1
1 4 9
4 5 11
1 5 9
Capacity=6
For this Test Case we can Take first 3 values which give us 24 as profit. Other choices give less profit, it can be verified.
Comments (3)