Your question is Nth Largest in Array. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A First Republic risk-monitoring workflow receives an unsorted array of integer scores. Return the kth largest score, counting duplicate values as separate positions.
Use a data structure that avoids sorting the entire array when k is relatively small.
Implement kth_largest(nums, k).
nums, a non-empty array of integers, and k, a positive integer.k - 1 after sorting nums in descending order.k elements.def kth_largest(nums, k):