Min stack
Design a stack that supports push, pop, top and returning the current minimum element, each in constant time. Explain how the minimum stays correct after pops, how you handle duplicate minimum values, and the extra memory your design uses.
No answer yet. Write the first one; the best answer gets endorsed.
