Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def leastInterval(self, tasks: List[str], n: int) -> int:
- d = {}
- m = 0
- for i in range(len(tasks)):
- if(tasks[i] not in list(d.keys())):
- d[tasks[i]] = 0
- d[tasks[i]] += 1
- if(m< d[tasks[i]]):
- m = d[tasks[i]]
- a = 0
- for k in list(d.keys()):
- if(d[k] == m):
- a += 1
- return max(m + a - 1 + (m-1)*n, len(tasks))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement