# Greedy algorithm for maintaining drugs

Given $$n$$ drugs such that each drug $$d_i$$ should maintain in interval $$[c_i,h_i]$$.We want to minimize number of containers to maintain medicines in compatible interval.

I use following greedy algorithm:

in each iteration, for remaining drugs, find an interval that have maximum number of compatible drugs, and remove that drugs, and add to container.

any one can help to find an counter example or proving above idea?

There are 6 drugs with intervals $$[1, 5],\ [2,8],\ [3,8]$$ and $$[6, 11], \ [6,12],\ [9, 13].$$
If we use the greedy algorithm, we would first cover $$[2,8],\ [3,8],\ [6, 11], \ [6,12]$$ using, for example, containers of volume 7. And then the remaining two intervals $$[1,5],\ [9,13]$$ that are disjoint will need additional two containers of different volumes to cover.