Maximum frequency stack
Build a stack of integers with push(x) and pop(). pop removes and returns the value that occurs most often in the stack; when several values tie, it takes the one with an occurrence closest to the top. Say how fast each operation is.
No answer yet. Write the first one; the best answer gets endorsed.
