public class Solution {
    //要求时间复杂度为o(1),使用辅助栈,存储每次的最小值
    Stack<Integer> minStack=new Stack<>();
    Stack<Integer> min=new Stack<>();
    
    public void push(int node) {
        if(min.empty()) min.push(node);
        else min.push(Math.min(min.peek(),node));
        minStack.push(node);
    }
    
    public void pop() {
        minStack.pop();
        min.pop();
    }
    
    public int top() {
        return minStack.peek();
    }
    
    public int min() {
        return min.peek();
    }
}