In a Meta-style ranking pipeline, you may need the kth largest score from an unsorted list without fully sorting it. Given an integer array nums and an integer k, return the kth largest element in the array.
The kth largest element is the value that would appear at position k in a descending sort, counting duplicates as separate elements.
nums: a list of integersk: an integer where 1 <= k <= len(nums)kth largest element in numsExample 1
nums = [3, 2, 1, 5, 6, 4], k = 25[6, 5, 4, 3, 2, 1], so the 2nd largest element is 5.Example 2
nums = [3, 2, 3, 1, 2, 4, 5, 5, 6], k = 44[6, 5, 5, 4, 3, 3, 2, 2, 1], so the 4th largest element is 4.1 <= len(nums) <= 10^5-10^4 <= nums[i] <= 10^41 <= k <= len(nums)