⚡️ Tryprepforge
Backend Engineer Senior programming

Write a function that returns the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 1: Input: nums = [3,2,1,5,6,4], k = 2 Output: 5 Example 2: Input: nums = [3,2,3], k = 1 Output: 3 Constraints: - 1 <= k <= nums.length <= 10^4 - -10^4 <= nums[i] <= 10^4.

Suggested Answer

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

No credit card required

More Backend Engineer Interview Prep

Link copied to clipboard