Skip to content

Instantly share code, notes, and snippets.

View Chinwendu20's full-sized avatar
🎯
Focusing

Maureen Ononiwu Chinwendu20

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am chinwendu20 on github.
  • I am oriaku_maureen (https://keybase.io/oriaku_maureen) on keybase.
  • I have a public key ASAc2xgo2amqXhMbZbAyCDVEfCu6hPssr0YZSIqD3a6cUwo

To claim this, I am signing this object:

@Chinwendu20
Chinwendu20 / .py
Created September 10, 2023 16:23
Neetcode's solution task scheduler
class Solution:
def leastInterval(self, tasks: List[str], n: int) -> int:
s = Counter(tasks)
# {A: 3, B: 3}
maxHeap = [-i for i in s.values()] #xxxxxxxx
# s.values() = [3, 3]
heapq.heapify(maxHeap)
# heapq.heapify(s.values())