LeetCode 215 Kth Largest Element in an Array - Why Naive Fails

The trap

Sort the array in descending order, return element at index k - 1.

Sorting takes O(nlogn)O(n \log n). But you only need the kth largest, not the full sorted order.

Can you find the answer faster by doing less work?