darrenfu/LeetcodePy

Sift

Closed this issue · 1 comments

Suboptimal solution is to use a K-size max-heap, using heapq.pushpop() since the (K+1)-th element. Time complexity: O(N*logK).
Optimal solution would be quick select.