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?
Let's try to solve this problem within 15 minutes.