
In this article, we will discuss the problem K-th largest Element in a stream, and understand the different methods that can be used to solve the problem efficiently.
Table of content:
Problem StatementApproach 1: Sorting the ArrayApproach 2: Using min-heap
We will dive into the problem now.
Problem Statement
Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.
Implement KthLargest class:
KthLa...
Published on August 24, 2021 09:17