图片说明

/**
 * return a array which include all ans for op3
 * @param op int整型二维数组 operator
 * @return int整型一维数组
 */
function getMinStack( op ) {
    // write code here
    let result = []
    let stack = []
    for(let item of op){
        if(item[0]==1){
            stack.push(item[1])
        }else if(item[0]==2){
            stack.pop()
        }else{
            result.push(Math.min(...stack))
        }
    }
    return result
}
module.exports = {
    getMinStack : getMinStack
};