| 18 | |
| 19 | |
| 20 | class Solution: |
| 21 | def leastInterval(self, tasks: List[str], n: int) -> int: |
| 22 | counter=Counter(tasks) |
| 23 | freq=sorted(list(counter.values())) |
| 24 | |
| 25 | max_idle=freq.pop() |
| 26 | total=(max_idle-1)*n |
| 27 | |
| 28 | while freq and total>0: |
| 29 | total=total-min(max_idle-1,freq.pop()) |
| 30 | |
| 31 | total=max(0,total) |
| 32 | return len(tasks) + total |
nothing calls this directly
no outgoing calls
no test coverage detected