Encounterd this question in an OA.
It would be really great, if someone can post the solution for this,
A certain store is testing drone delivery. A drone can
carry multiple items within its maximum weight capacity it can
carry. There are certain items to be delivered from the store to
the customers and the store decides to use two drones to
deliver the items and the remaining items will be delivered by
John manually. Help John to save his effort by making him carry
minimal weight.
Input:
The first line contains the capacities of each drone and number
of items W1, W2,i
The second line contains an array of item weights W1,w2,w3...Wi
Output:
Print the minimum weight that John will be carrying
i belongs to N (Natural Numbers) and wi belongs to W (Whole Numbers)
O< < 2000. 0<= wi <=3000.
0<=W1.W2<=2000000
TestCase
25 13 5
2 5 7 10 17
**Explanation: **
Items with weights 7 and 17 can be carried by
Drone 1 and items with weights 2 and 10 can be carried by
Drone 2 and John will be carrying the remaining item with
weight 5