Your question is Implement Nth Largest Number. 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.
An Airtel Payments Bank analytics pipeline receives an unsorted array of integer transaction values. Implement a function that returns the nth largest value, counting duplicate values as separate elements.
You must avoid fully sorting the array. Use an appropriate data structure to maintain only the values needed to determine the result.
Implement nth_largest(nums, n).
nums, a non-empty list of integers, and n, a 1-indexed integer.n when nums is sorted in descending order.[7, 7, 3] is 7.def nth_largest(nums, n):