C++ Super Simple and Clean Solution
Idea:\nWe use a stack that stores pairs of { val, min_so_far }.\nWe also have a curr_min for the current min.\nWith this idea, implementation is super simple.\n
**Idea:**\nWe use a stack that stores pairs of `{ val, min_so_far }`.\nWe also have a `curr_min` for the current min.\nWith this idea, implementation is super simple.\n```\nclass MinStack {\npublic:\n    MinStack() {}\n    \n    void push(int val) {\n        if (val < curr_min) {\n            s.push({val, val});\n            curr_min = val;\n        }\n        else s.push({val, curr_min});\n    }\n    \n    void pop() {\n        s.pop();\n        curr_min = s.empty() ? INT_MAX : s.top().second;\n    }\n    \n    int top() {\n        return s.top().first;\n    }\n    \n    int getMin() {\n        return curr_min;\n    }\n    \nprivate:\n    stack<pair<int, int>> s;\n    int curr_min = INT_MAX;\n};\n```\n**Like it? please upvote!**
['C']