class Solution {
private:
vector<int> vec;
public:
void push(int value) {
vec.emplace_back(value);
}
void pop() {
if(vec.empty()) return;
vec.erase(vec.end()-1);
}
int top() {
if(vec.empty()) return 0;
return *(vec.end()-1);
}
int min() {
if(vec.empty()) return 0;
return *min_element(vec.begin(), vec.end());
}
};
转载于:https://www.cnblogs.com/theodoric008/p/9537800.html