Suppose you have a system, the input is an dynamic integer data stream. Suppose the data stream contains duplicate value. Find the kth largest elements in the data stream and return the index. If the duplicate values exist in multiple index, return them all.
Eg: The data stream is 4,2,2,3,1, k is 4, the answer is 2. The index is 1,2.
The data steam is 1,2,3,4,5, k is 3, the answer is 3 and the index is 2.
Uber find the largest kth element in a data stream


In example 4,2,2,3,1, k = 4 and the fourth largest number is 2 , we have 4 ,3,2,2 and we must return 1,2 because the index of two 2 is 1 and 2 in the stream
I suggest to use max heap for first largest k elements and to keep indexes of the element on the top of the heap in order to return the result

@GoGoDong Yes. Usually it means that the data stream is very large and as a result you may not store all data in memory.
