class MinStack {
stack<int>stack1;
stack<int>min_stack;
public:
MinStack() {
min_stack.push(INT_MAX);
}
void push(int val) {
stack1.push(val);
min_stack.push(min(min_stack.top(),val));
}
void pop() {
stack1.pop();
min_stack.pop();
}
int top() {
return stack1.top();
}
int getMin() {
return min_stack.top();
}
};
/**
* Your MinStack object will be instantiated and called as such:
* MinStack* obj = new MinStack();
* obj->push(val);
* obj->pop();
* int param_3 = obj->top();
* int param_4 = obj->getMin();
*/