题解 | #用两个栈实现队列#
用两个栈实现队列
https://www.nowcoder.com/practice/54275ddae22f475981afa2244dd448c6
const pushStack = []
const popStack = []
function push(node)
{
// write code here
pushStack.push(node)
}
function pop()
{
// write code here
if (popStack.length === 0) {
while (pushStack.length > 0) {
popStack.push(pushStack.pop())
}
}
return popStack.pop()
}
module.exports = {
push : push,
pop : pop
};

