176 - 621 任务调度器
题目
解答
class Solution:
def leastInterval(self, tasks: List[str], n: int) -> int:
c = [0]*26
for task in tasks:
c[ord(task)-65] += 1
c.sort()
i = 25
while i >= 0 and c[i] == c[25]:
i -= 1
return max(len(tasks), (c[25]-1)*(n+1)+25-i)Last updated