Shopping and Billing

Asked at WeWork · Coding Questions · Difficulty: Medium

In a shop with `N` counters, `M` people arrive for billing at different times denoted as `time[i]`. Each person selects the counter with the shortest queue, based on the number of people already present. If a counter is empty, the person gets immediate billing, otherwise, they join the queue.

Loading the problem…