We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b20b616 commit ad9df2aCopy full SHA for ad9df2a
0621-task-scheduler/0621-task-scheduler.py
@@ -0,0 +1,6 @@
1
+class Solution:
2
+ def leastInterval(self, tasks: List[str], n: int) -> int:
3
+ freq = Counter(tasks)
4
+ Most_freq = freq.most_common()[0][1]
5
+ Found_most = sum([freq[key] == Most_freq for key in freq])
6
+ return max(len(tasks), (Most_freq - 1) * (n + 1) + Found_most)
0 commit comments