# Kth Largest Element in a Stream

Given an infinite stream of integers, design a class to find the kth largest element at any point in time in the stream.

## We'll cover the following

## Statement

Given an infinite stream of integers, design a class to find the $k^{th}$ largest element in a stream.

Note: It is the $k^{th}$ largest element in the sorted order, not the $k^{th}$distinctelement.

Implementation of the class should be:

- Initializes the object with the integer $k$ and the stream of integers.
- The
`add(value)`

function appends the value to the stream and returns the element that represents the $k^{th}$ largest element in the stream.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.