from collections import Counter
def leastInterval(self, tasks, n):
m = len(tasks)
c = sorted(Counter(tasks).values(), reverse=True)
c = [xi-1 if xi==max(c) else xi for xi in c]
return max(c*(n+1)+m-sum(c), m)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.