Kiln Firing Schedule
mediumA pottery kiln fires one batch per time slot. Each pending batch has a glaze type (a letter in batches), and after firing a glaze the kiln needs at least n slots before firing that same glaze again — otherwise the colors bleed. Different glazes can fire back-to-back, and the kiln may sit idle for a slot when nothing is safe to fire.
Return the minimum total number of slots (firings plus idles) needed to fire every batch.
Example 1
in batches = ["A", "A", "A", "B", "B", "B"], n = 2
out 8
A B idle A B idle A B — each A is 3 slots from the previous A.
Example 2
in batches = ["A", "A", "A", "B", "B", "B"], n = 0
out 6
No cooldown: fire them all back-to-back.
Constraints
- · 1 <= len(batches) <= 2000
- · batches[i] is an uppercase letter A-Z
- · 0 <= n <= 100
solution.py● loading python…
test results
Hit ▶ Run to test your code against the visible cases.