Implement a stack with min() function, which will return the smallest number in the stack.
It should support push, pop and min operation all in O(1) cost.
min operation will never be called if there is no number in the stack.
Have you met this question in a real interview?
Yes
Example
解法一:
解法二: