215. Kth Largest Element in an Array

Description

Find 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.

Note: You may assume k is always valid, 1 ≤ k ≤ array's length.

Constraints

Approach

  • GeeksforGeeks

  • ProgramCreek

  • YouTube

Examples

Input: [3, 2, 1, 5, 6, 4] and k = 2

Output: 5

Solutions

Follow up

Last updated

Was this helpful?