Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def queue_time(customers: list[int], n: int) -> int:
- if not customers:
- return 0
- if n == 1:
- return sum(customers)
- customer_amount = len(customers)
- if customer_amount <= n:
- return max(customers)
- customers.reverse()
- tills = [0] * n
- output = 0
- while customers:
- for idx in range(n):
- if tills[idx] == 0 and customers:
- tills[idx] = customers.pop() - 1
- else:
- tills[idx] -= 1
- output += 1
- return output + max(tills)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement