holabolaholabola's blog

By holabolaholabola, history, 7 weeks ago, In English

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

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it