```
class MinStack {
Stack<Integer> s = new Stack<Integer>();
Stack<Integer> min = new Stack<Integer>();
//int min=-1;
public void push(int x) {
if(min.empty() || x <= min.peek())
min.push(x);
s.push(x);
}
public void pop() {
if(!s.empty()){
if((int)min.peek() == (int)s.peek())
min.pop();
s.pop();
}
}
public int top() {
if(!s.empty()){
return s.peek();
}
return -1;
}
public int getMin() {
return min.peek();
}
```

}