Back to course home
0% completed
Vote For New Content
Kth Largest Element in an Array (medium)
Problem Statement
Given an integer array nums and an integer k, return the k<sup>th</sup> largest element in the array.
Note that you need to return the k<sup>th</sup> largest element in the sorted order, not the k<sup>th</sup> distinct element.
Try solving it without using sorting.
Examples
Example 1:
- Input: nums = [10, 20, 15, 3, 5], k = 3
- Expected Output: 10
- Explanation: Sorted array in descending order is [20, 15, 10, 5, 3]. The 3rd largest is 10.
Example 2:
- Input: nums = [7, 7, 8, 8, 9], k = 3
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible