Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
To simulate the problem we first need to note that if at any point in time there are no enqueued tasks we need to wait to the smallest enqueue time of a non-processed element
We need a data structure like a min-heap to support choosing the task with the smallest processing time from all the enqueued tasks