C++ stack with {val, min} pair
\nclass MinStack {\npublic:\n    //pair.first = actual value\n\t//pair.second = min value from the top (current value) to bottom of the stack\n    stack<pair<in
```\nclass MinStack {\npublic:\n    //pair.first = actual value\n\t//pair.second = min value from the top (current value) to bottom of the stack\n    stack<pair<int, int>> s; \n    int minVal;\n    \n    MinStack() {\n        minVal = INT_MAX;\n    }\n    \n    void push(int val) {\n        if (s.size() == 0) {\n            minVal = val;\n        } else {\n            minVal = s.top().second;\n        }\n        minVal = min(minVal, val);\n        s.push({val, minVal});\n    }\n    \n    void pop() {\n        s.pop();\n    }\n    \n    int top() {\n        return s.top().first;\n    }\n    \n    int getMin() {\n        return s.top().second;\n    }\n};\n\n/*\nif (you like this) {\n\tplease upvote;\n}\n*/\n \n```
[]