Quickselect: Kth Largest Element Without Using a Heap

Given an integer array nums and an integer k, return the k-th largest element in the array (in sorted order; duplicates count separately).

Requirements:

  • Average time complexity O(n); use th...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: