45. find the K-th largest element in an unsorted array
Share
medium - accepted / - tried
You are given an unsorted array of numbers, which might have duplicates, find the K-th largest element.
The naive approach would be sort it first, but it costs O(nlogn)
, could you find a better approach?
Maybe you can recall what is happening in Quick Sort or Priority Queue