Open pwstrick opened 4 years ago
var arr1 = [], //栈 A arr2 = []; //栈 B function push(node) { arr1.push(node); } function pop() { if (arr2.length > 0) { return arr2.pop(); } while (arr1.length > 0) { arr2.push(arr1.pop()); } return arr2.pop(); }