Skip to content

Latest commit

 

History

History
10 lines (6 loc) · 226 Bytes

README.md

File metadata and controls

10 lines (6 loc) · 226 Bytes

Idea

1. Sort

This is quite simple, we sort the whole array, which costs O(nlgn).

2. Min Heap

build a min heap, and we keep track of the k-th largest elements. then we just pop the smallest value of this heap