Leetcode Problem 215. Kth Largest Element in an Array
215. Kth Largest Element in an Array
Leetcode Solutions
Approach: Min-Heap
Initialize a min-heap.
Iterate over each element in the array.
a. Add the current element to the heap.
b. If the heap size exceeds k, remove the smallest element from the heap.
The root of the heap is the kth largest element, return it.