minimum number of bags question

Hello, can somebody help how to solve this question...

Given a bag weight capacity of n, what is the minimum numbers of bags required to put the following items of weights in to the bags. Each bag can only take 2 items at most.
For example if weights of items are: [5,1,2,4,5,6,6] and capacity is n=7
Then, answer is 5. becuase bags can be: [6,1], [6], [5,2], [5,1], [4]

Comments (1)