function IsPopOrder(pushV, popV) { // write code here var stack = []; var index = 0; for(let i = 0;i<pushV.length;i++){ stack.push(pushV[i]); while(stack.length&&popV[index]==stack[stack.length-1]){ stack.pop(); index++; } } return stack.length==0; }