C++ using two stacks, quite short and easy to understand
class MinStack {\n    private:\n\t    stack<int> s1;\n\t    stack<int> s2;\n    public:\n\t    void push(int x) {\n\t\t    s1.push(x);\n\t\t    if (s2.empty() |
    class MinStack {\n    private:\n\t    stack<int> s1;\n\t    stack<int> s2;\n    public:\n\t    void push(int x) {\n\t\t    s1.push(x);\n\t\t    if (s2.empty() || x <= getMin())  s2.push(x);\t    \n        }\n        void pop() {\n\t\t    if (s1.top() == getMin())  s2.pop();\n\t\t    s1.pop();\n\t    }\n        int top() {\n\t\t    return s1.top();\n\t    }\n        int getMin() {\n\t\t    return s2.top();\n\t    }\n    };
['C++']