ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
<div id="div5"><h4> 5, 用两个栈实现队列 <h4></div> ```javascript const outStack = [], inStack = []; function push(node) { // write code here inStack.push(node); } function pop() { // write code here if (!outStack.length) { while (inStack.length) { outStack.push(inStack.pop()); } } return outStack.pop(); } ```