使用一个栈模拟压入弹出操作
var inarr = [] var outarr = [] function IsPopOrder(pushV, popV) { // write code here for (var i=0;i<pushV.length;i++) { inarr.push(pushV[i]) while(inarr.length> 0 && inarr[inarr.length-1] === popV[0]) { inarr.pop() popV.shift() } } if(inarr.length>0) { return false } else { return true } } module.exports = { IsPopOrder : IsPopOrder };