import java.util.*;
public class Solution {
/**
* return a array which include all ans for op3
* @param op int整型二维数组 operator
* @return int整型一维数组
*/
public int[] getMinStack (int[][] op) {
int opt = 0;
for(int i=0; i<op.length; i++)
if(op[i].length==1 && op[i][0]==3)
opt++;
int[] res = new int[opt];
int ind = 0;
Solution stack = new Solution();
for(int i=0; i<op.length; i++){
if(1 == op[i][0])
stack.push(op[i][1]);
else if(2 == op[i][0])
stack.pop();
else
res[ind++] = stack.getMin();
}
return res;
}
int[] nums = new int[8];
int index = 0;
public void push(int n){
if(index == (nums.length-1)){
nums = Arrays.copyOf(nums,nums.length*2);
}
nums[index++] = n;
}
public int pop(){
return nums[index--];
}
public int getMin(){
int min = nums[0];
for(int i=1; i<index; i++){
min = Math.min(min,nums[i]);
}
return min;
}
}