Medium

Quiz

#215 Kth Largest Element in an Array

APPROACH

Find the k-th largest value (in sorted order, counting duplicates) in the integer array nums and return it. Can you avoid a full sort?

Example 1:

Input: nums = [3,2,1,5,6,4], k = 2
Output: 5

Example 2:

Input: nums = [3,2,3,1,2,4,5,5,6], k = 4
Output: 4
1 of 4
1:00

What is the optimal approach for this problem?