2、数组中的重复数字
文章目录
题目
- 分析
- 代码
import java.util.Stack;
public class Solution {
Stack<Integer> stack1 \= new Stack<Integer>();
Stack<Integer> stack2 \= new Stack<Integer>();
public void push(int node) {
while(!stack2.empty()){
stack1.push(stack2.pop());
}
stack1.push(node);
while(!stack1.empty()){
stack2.push(stack1.pop());
}
}
public int pop() {
return stack2.pop();
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论