kth-largest-element-in-an-arrayV1.py (204B)
1 import heapq 2 3 4 class Solution: 5 def findKthLargest(self, nums: List[int], k: int) -> int: 6 nums = [-num for num in nums] 7 heapq.heapify(nums) 8 return -heapq.nsmallest(k, nums)[-1]
leetcodeLeetcode submissions | |
| git clone git://git.laack.co/leetcode.git | |
| Log | Files | Refs | README |