mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update and rename k_element_stream.py to kth_largest_stream.py
This commit is contained in:
parent
f75b102b78
commit
66cf6cc427
@ -14,7 +14,6 @@ class KthLargest:
|
|||||||
while len(self.heap) > k:
|
while len(self.heap) > k:
|
||||||
heapq.heappop(self.heap)
|
heapq.heappop(self.heap)
|
||||||
|
|
||||||
|
|
||||||
def add(self, val: int) -> int:
|
def add(self, val: int) -> int:
|
||||||
|
|
||||||
heapq.heappush(self.heap, val)
|
heapq.heappush(self.heap, val)
|
||||||
@ -23,5 +22,3 @@ class KthLargest:
|
|||||||
|
|
||||||
return self.heap[0]
|
return self.heap[0]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user