堆排序 class Solution: def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ import heapq nums = [-num for num in nums] heapq.heapify(nums) res = float('inf') for _ in range(k): res = heapq.heappop(nums) return -res