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: 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]