Kth Largest Element in an Array
Question
Given an integer array nums and an integer k, return the kth largest element in the array.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
Input: nums = [3, 2, 1, 5, 6, 4], k = 3
Output: 4
The 3rd largest element in the array is 4.
Input: nums = [1, 3, 2, 2, 2, 0], k = 5
Output: 1
The 5th largest element in the array is 1.
Clarify the problem
What are some questions you'd ask an interviewer?
main.py
Login or signup to save your code.
Bookmark
Reset
Run to test on sample or custom input ยท Submit to grade against all cases
Input
Expected
Actual
Standard OutputScroll down...
Looks like you don't have access yet
Members get the full walkthrough, the working code, and the complexity explained.
Get full accessNot sure what this unlocks? Check out a free pattern section.

Code Solution

Complexity
