How can I solve this problem? Any kind of help regarding this problem will be appreciated.
The abridged problem is:
Given a sequence of numbers. You have to perform 3 types of queries.
1 V: Add V to the end of the sequence.
2: remove an element from the end of the sequence.
3 l r: Find the K'th largest number in the range.
It is guaranteed that 1 <= l <= r <= the total number of elements in the current sequence.