← ALL NOTES
Array

215. Kth Largest Element in an Array

Find the k-th largest element. Sorting the whole array is O(n log n) and gives you far more order than you asked for — you only need one element in its final sorted position. Quickselect does exactly…

Loading…