Problem
Return the kth largest element in the array.
Example 1
Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
Constraints
- 1 <= k <= nums.length <= 10^5
Notes
- Focus on the underlying heap pattern.
- Write the cleanest correct solution before optimizing further.
- Hidden tests cover larger edge cases than the visible examples.