import java.util.Stack;
public class Solution {
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node) {
stack1.push(node);
}
public int pop() {
Integer i =null;
if(!stack2.empty()){
i = stack2.pop();
}else{
while(!stack1.empty()){
i = stack1.pop();
stack2.push(i);
}
i = stack2.pop();
}
return i;
}
}
具体的讲解,等后续。
45

被折叠的 条评论
为什么被折叠?



