2365. Task Scheduler II
On This Page
class Solution:
def taskSchedulerII(self, tasks: List[int], space: int) -> int:
day = defaultdict(int)
res = 0
for task in tasks:
res += 1
res = max(res, day[task])
day[task] = res + space + 1
return res