C++ solution using pair and one stack
class MinStack {\n         stack<pair<int, int>> st;\n    \n    public:\n        void push(int x) {\n            int min;\n            if (st.empty()) {\n      
    class MinStack {\n         stack<pair<int, int>> st;\n    \n    public:\n        void push(int x) {\n            int min;\n            if (st.empty()) {\n                min = x;\n            }\n            else {\n                min = std::min(st.top().second,x);\n            }\n            st.push({x, min});\n        }\n    \n        void pop() {\n            st.pop();\n        }\n    \n        int top() {\n            return st.top().first;\n        }\n    \n        int getMin() {\n            return st.top().second;\n        }\n    };
['C++']