Maximum frequency stack

0
Remix

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.

AmazonCodingLast asked Oct 2026
No answer yet. Write the first one; the best answer gets endorsed.