the answer given by the system(leetcode OJ) could be like this:

dataStack{5,4,3,3,3,3,3,...,3,3,2} (push data from the left hand to the right hand)

MinStack {5,4,3,3,3,3,3,....3,3,2}

It is not so good.

However, my code would be like this:

MinStack{5,4,3,2} with a counter for every data in the MinStack.

In fact, only when there's little or a little two or more same numbers, the codes gived by leetcode OJ are best.

Here's my codes:

```
class MinStack {
public:
struct NODE{
int val;
int cnt;
};
stack<NODE> s_min;
stack<int> s_data;
void push(int x) {
s_data.push(x);
if(s_min.empty()||x<s_min.top().val)
{
NODE node;
node.val=x;
node.cnt=1;
s_min.push(node);
}
else
{
NODE node=s_min.top();
s_min.pop();
node.cnt++;
s_min.push(node);
}
}
void pop() {
NODE node=s_min.top();
s_min.pop();
node.cnt--;
if(node.cnt>0)
s_min.push(node);
s_data.pop();
}
int top() {
return s_data.top();
}
int getMin() {
return s_min.top().val;
}
};
```