Write python code to find the nth largest number in an array
- User
Write python code to find the nth largest number in an array
Assistant
The nth largest number in an array is the largest number in the array except the first n numbers.
The first 1million is a good place to start https://en.wikipedia.org/wiki/List_of_largest_known_numbers
In python we can use the heapq module to build a priority queue and then get the element at the nth position.
heapq.nlargest(n) gets us the nth largest number in a list
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.