Wine Tasting Problem

Every day, you are presented with batches of wines and knowing they aren’t going anywhere, you take your own time to taste them. You take a sample from a batch and taste it. Then you wait at least N minutes before tasting another sample from the same batch to let the taste sink in. However, during this period, you can take a sample from batch or sit idle.

Your job is to find the minimum time in which you can finish the tasting task by designing a schedule.

You are given 2 integers B and N denoting the number of batches and the minimum time you need to wait between samples from same batch followed by B lines denoting B[i] denoting the number of samples in ith batch.

My Approach:

If the number of batches is less then N+1, then we have a straight-forward case, where the answer will depend on only the batch that has the maximum size as we will be able to fill the waiting time with samples from other batches.

I am stuck on CaseII: when B > N+1, and having difficulty to desing a schedule for that. Can anyone help me?

P.S - It’s not my homework. I found this question in a test, tried it, couldn’t solve it and have been stuck on it since.