Update and rename k_element_stream.py to kth_largest_stream.py

This commit is contained in:
bt3gl 2023-08-08 16:45:59 -07:00 committed by GitHub
parent f75b102b78
commit 66cf6cc427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,6 @@ class KthLargest:
while len(self.heap) > k:
heapq.heappop(self.heap)
def add(self, val: int) -> int:
heapq.heappush(self.heap, val)
@ -22,6 +21,4 @@ class KthLargest:
heapq.heappop(self.heap)
return self.heap[0]