class Solution { private: vector<int> list; vector<int> min_list; public: void push(int value) { if(list.empty()) { list.push_back(value); min_list.push_back(0); } else{ if(value<list.at(min_list.at(min_list.size()-1))) { list.push_back(value); min_list.push_back(list.size()-1); } else { list.push_back(value); min_list.push_back(min_list.at(min_list.size()-1)); } } } void pop() { list.pop_back(); min_list.pop_back(); } int top() { return list.at(list.size()-1); } int min() { return list.at(min_list.at(min_list.size()-1)); } };