Skip to content

Commit ad9df2a

Browse files
Time: 373 ms (99.23%), Space: 14.4 MB (59.79%) - LeetHub
1 parent b20b616 commit ad9df2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)