当前位置:网站首页>牛客-TOP101-BM42
牛客-TOP101-BM42
2022-07-30 11:13:00 【一条吃猫的鱼】
import java.util.*;
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() {
while(!stack1.isEmpty()){
stack2.push(stack1.pop());
}
int num = stack2.pop();
while(!stack2.isEmpty()){
stack1.push(stack2.pop());
}
return num;
}
}
边栏推荐
猜你喜欢
随机推荐
decodeURIComponent(), eval(), encodeURIComponent()
The battle-hardened programmer was also deceived by a fake programmer from a certain fish. The trust between programmers should be the highest, and he alone destroyed this sense of trust
C语言 — 位运算操作
Unity 锁定相机第二弹
RY-D1/1电压继电器
安全提示:Qt中的FreeType
Introduction to IoT Technologies: Chapter 6
【Flume】batchSize和transactionCapacity区别
WebAPI 复习
[ASP.NET Core] Dependency Injection for Option Classes
vscode中写markdown格式笔记的配置过程和相关语法
pg_rewind 修复主备环境的时间线
wsl操作
正则表达式快速入门笔记
EA中的业务对象和业务实体你分得清吗?
Typroa alternative tool marktext
RY-D1/1 Voltage Relay
XYplorer 23多语言,最好的管理软件之一
Detailed explanation of @RequestBody and @ResponseBody
物联网技术概论:第6章