Startup | Onsite
Anonymous User
169

Hi,
Given an item list, and weight of the bag. Fill all the items in minimum no of bags.
Print the list of items occupied by each bag.
Ex: 1.
Item list: 10,8,7,6,5,4
Weight of the bag: 20
We can have two bag here to fill all the items
B1: 10,6,4
B2: 8,7,5

Ex: 2:
Item list: 10,10,5,5,5,4,4,4,4
Weight of the bag: 20
We can have three bag here to fill all the items
B1: 10,10
B2: 5,5,5,4
B3:4,4,4
Note: Item can be duplicate in list, but once used in any bag cannot be addded in another bag.

Similar Question: https://stackoverflow.com/questions/23689236/knapsack-with-multiple-bags-and-items-having-only-weight

Comments (2)