标签:amp plain algorithm gid sub sem 数据结构 des coder
class Solution { public: void push(int value) { data.push(value); if(minnum.empty()) minnum.push(value); else if(minnum.top()<value) minnum.push(minnum.top()); else minnum.push(value); } void pop() { if(!data.empty()) { data.pop(); minnum.pop(); } } int top() { return data.top(); } int min() { return minnum.top(); } private: stack<int> data; stack<int> minnum; };
标签:amp plain algorithm gid sub sem 数据结构 des coder
原文地址:https://www.cnblogs.com/evidd/p/10623219.html