There was an error while loading. Please reload this page.
2 parents 141ddf8 + 54b5a18 commit 9b8dc7bCopy full SHA for 9b8dc7b
LeetCode/0215_Kth_Largest_Element_In_An_Array.py
@@ -0,0 +1,6 @@
1
+import heapq
2
+class Solution:
3
+ def findKthLargest(self, nums: List[int], k: int) -> int:
4
+ heapq.heapify(nums)
5
+ res = heapq.nlargest(k,nums)
6
+ return res[len(res)-1]
0 commit comments