Intel | OA | Minimize weight, value meet the threshold requirement/ Inverse knapsack problem?
Anonymous User
947

Given 2 array of weight and value, return the minimal total weight such that total value >= threshold value
Example

Weight [5,20,32,10]
Value  [13,30,35,20]
Threshold = (13+30+35+20)/2 +1 = 50
Output :  30 
Weight [11,11,21]
Value [32,32,64]
threshold : 65
output -> 32 
weight [5,10,15,20]
value  [10,10,10,10]
threshold : 21
output -> 15
weight [8,6,6]
value  [5,5,1]
threshold : 6
output -> 12
Comments (3)