小顶堆实现求数组中第k大元素

class Solution:
    def findKthLargest(self, nums: List[int], k: int) -> int:
        heap=nums[:k]
        def heapify(heap,i):
            while True:
                heapmin=i
                if 2*i+1

 

你可能感兴趣的:(小顶堆实现求数组中第k大元素)