Skip to content

Commit

Permalink
Create: 1985-Find-The-Kth-Largest-Integer-In-The-Array.py
Browse files Browse the repository at this point in the history
  • Loading branch information
UdayGarg committed Oct 5, 2022
1 parent c50d6fa commit ddb34f7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/1985-Find-The-Kth-Largest-Integer-In-The-Array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def kthLargestNumber(self, nums: List[str], k: int) -> str:
maxHeap = [-int(n) for n in nums]
heapq.heapify(maxHeap)
while k>1:
heapq.heappop(maxHeap)
k-=1
return str(-maxHeap[0])

0 comments on commit ddb34f7

Please sign in to comment.