문제

class MinStack {
private:
	stack<int> st;
	stack<int> minSt;

public:
	MinStack() {
	}

	void push(int val) {
		this->st.push(val);
		if (this->minSt.empty() || val <= this->minSt.top()) this->minSt.push(val);
	}

	void pop() {
		int top = st.top();
		this->st.pop();
		if (top == this->minSt.top()) this->minSt.pop();
	}

	int top() {
		return this->st.top();
	}

	int getMin() {
		return this->minSt.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();
 */