Login and Buy Premium to Start the Interview
Find the Kth Largest Number in a List
Problem Statement
Determine the kth largest number from an unsorted list of integers. Remember, this is the kth largest value in sorted order, including duplicates.
Examples
Example 1:
Array: [4, 7, 2, 9, 5, 1] and k = 3
Result: 5
Example 2:
Array: [10, 15, 10, 8, 7, 15, 20, 20, 25] and k = 5
Result: 15
Constraints
- The length of the list is between 1 and 15,000.
- Values in the list can range from -20,000 to 20,000.
- k will always be a valid index within the list length.