public class Solution {
Stack<Integer> stack = new Stack<>();
Stack<Integer> stack2 = new Stack<>();
public void push(int node) {
stack.push(node);
if(stack2.isEmpty()){
stack2.push(node);
}else{
if(node <= stack2.peek()){
stack2.push(node);
}else{
stack2.push(stack2.peek());
}
}
}
public void pop() {
stack.pop();
stack2.pop();
}
public int top() {
return stack.peek();
}
public int min() {
return stack2.peek();
}
}