82. Kth Largest Value
Medium
Given an array of integers and a number k, return the k-th largest value in descending order. Duplicate values occupy separate positions in that order.
Example 1
Input: valores = [7, 1, 9, 4, 9], k = 2
Output: 9
Example 2
Input: valores = [5, 3, 8, 2], k = 3
Output: 3
Constraints
- 1 <= k <= valores.length <= 10^5
- -10^9 <= valores[i] <= 10^9
HeapArrays
Saved in this browser
Caso 1
valores =
[7,1,9,4,9]
k =
2
Expected =
9
Caso 2
valores =
[5,3,8,2]
k =
3
Expected =
3
Run checks these 2 cases. Submit runs all 6, including hidden ones.