6 lines concise and easy understand c++ solution
class MinStack {\n    public:\n        void push(int x) {\n            int minnum = st.empty() ? x : min(st.top().second, x);\n            st.push(make_pair(x, 
    class MinStack {\n    public:\n        void push(int x) {\n            int minnum = st.empty() ? x : min(st.top().second, x);\n            st.push(make_pair(x, minnum));\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    private:\n        stack<pair<int, int>> st;\n    };
[]