How to solve this question?

Revision en1, by JulitoPeligro, 2022-06-25 16:45:01

I have multiple queries and queries are of 2 types and i also have empty stack like datastructure but i can remove any element in a stack in 0(1) .If given type 1 query i need to add that element into the stack. If given type 2 i need to remove the element which has highest frequency in the stack and if there are multiple elements with highest frequency i need to remove the element which is near to the top of stack. n<=10^5

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English JulitoPeligro 2022-06-25 16:45:01 455 Initial revision (published)