medium
arrays
heap
priority-queue
Given an integer array nums and integer k, return the kth largest value in sorted order. Duplicates count as separate positions.
Examples
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
Example 3
Input: nums = [1], k = 1
Output: 1
🔒 5 hidden
Running will execute all 8 cases, including 5 hidden ones.