```
#define SIZE 10
class MinStack {
private:
int count;
int* curr;
int* first;
int* pmin;
int* min;
public:
MinStack(){
first = new int[SIZE];
pmin = new int[SIZE];
curr = first;
count = 0;
min = pmin;
*min=65536;
}
~ MinStack(){
delete[] first;
delete[] pmin;
}
void push(int x) {
if(count<SIZE){
if(x <= *min){
min++;
*min=x;
}
*curr = x;
curr++;
count++;
}
}
void pop() {
if(count > 1){
curr--;
count--;
if(*curr == *min){
min--;
}
}
}
int top() {
return *(curr-1);
}
int getMin() {
*(min);
}
};
```