MyStack() { } voidpush(int x){ q.push_back(x); } intpop(){ int ret = q[q.size()-1]; q.pop_back(); return ret; } inttop(){ return q[q.size()-1]; } boolempty(){ if (q.size() == 0) returntrue; returnfalse; } };
/** * Your MyStack object will be instantiated and called as such: * MyStack* obj = new MyStack(); * obj->push(x); * int param_2 = obj->pop(); * int param_3 = obj->top(); * bool param_4 = obj->empty(); */ // @lc code=end