Skip to content

Commit ddb34f7

Browse files
committed
Create: 1985-Find-The-Kth-Largest-Integer-In-The-Array.py
1 parent c50d6fa commit ddb34f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def kthLargestNumber(self, nums: List[str], k: int) -> str:
3+
maxHeap = [-int(n) for n in nums]
4+
heapq.heapify(maxHeap)
5+
while k>1:
6+
heapq.heappop(maxHeap)
7+
k-=1
8+
return str(-maxHeap[0])

0 commit comments

Comments
 (0)