stacks1;

stacks2;

MinStack::MinStack() {

while(s1.size())

s1.pop();

```
while(s2.size())
s2.pop();
```

}

void MinStack::push(int x) {

s1.push(x);

```
if(s2.empty())
s2.push(x);
else if(s1.top() < s2.top())
s2.push(x);
```

}

void MinStack::pop() {

if(s1.empty())

return;

```
if(s1.top() == s2.top())
s2.pop();
s1.pop();
```

}

int MinStack::top() {

if(s1.empty())

return -1;

```
return s1.top();
```

}

int MinStack::getMin() {

if(s1.empty())

return -1;

return s2.top();

}