CODING

Day 7: The “Kth Largest Element in an Array” Problem

Anjana Sudhir
The Code Shelf

--

Problem:

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.

Example 1:

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

Example 2:

Input

--

--

Anjana Sudhir
The Code Shelf

Senior Software Engineer & Scrum Master @ Agoda (Booking Holdings Inc.)