MLE and accept after change all the vector to stack
Below is my accepted code. If you change all the stack to vector, as well as all the top to back and push to push_back, pop to pop_back, then you'll get a MLE.\
Below is my accepted code. If you change all the stack to vector, as well as all the top to back and push to push_back, pop to pop_back, then you'll get a MLE.\n\nWHY?\n**Is there a tricky implement of stack in STL or does the vector brings me the fuss?**\nthanks for your attention and answer!\n\n    class MinStack {\n    private:\n        stack<int> sta;\n        stack<int> minSta;\n    public:\n        void push(int x) {\n            sta.push(x);\n            if(!minSta.size() || minSta.top() >= x)\n                minSta.push(x);\n        }\n    \n        void pop() {\n            if(!sta.empty()) {\n                if(!minSta.empty() && sta.top() == minSta.top())\n                    minSta.pop();\n                sta.pop();\n            }\n        }\n    \n        int top() {\n            if(!sta.empty()) return sta.top();\n        }\n    \n        int getMin() {\n            if(!minSta.empty()) return minSta.top();\n        }\n    };
['Stack']