Error:
do not know how to do: Actually I know part of answer, but do not think it thoroughly.
In here, we have two cases: mainly of max. char or not mainly of max. char.
ideally, the answer is idle + total of task
so it need to know how many idle in it. which we get (max. - 1) * n empty position and fill remain alpha in it, if idle >= 0 than output idle + task.size(), otherwise output task.size()
use priority_queue to do this:
1. store the times of each character occur.
2. treat each intervals as the time slots, try to fill the task into the slots.
3. accumulate the time