当前位置:网站首页>牛客-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;
}
}
边栏推荐
猜你喜欢

活动速递| Apache Doris 性能优化实战系列直播课程初公开,诚邀您来参加!

神经网络学习笔记4——自动编码器(含稀疏,堆叠)(更新中)

HJY-F931A/YJ three-phase voltage relay

ESP32CAM 1838接收红外遥控器信号

电流继电器JL-8GB/11/AC220V

Current relay JL-8GB/11/AC220V

Introduction to IoT Technologies: Chapter 6

High energy output!Tencent's internal MyCat middleware manual, both theoretical and practical

ABP学习资源整理

MySQL——数据库基础
随机推荐
【 HMS core 】 【 Analytics Kit] [FAQ] how to solve the payment amount in huawei pay analysis shows zero problem?
Beyond Stream Processing!The 4th real-time computing Flink challenge is launched, and 490,000 prizes are waiting for you!
零代码开发入门:快速上手DIY函数公式的5个步骤
深入浅出零钱兑换问题——背包问题的套壳
XYplorer 23多语言,最好的管理软件之一
美团内推+校招笔试题+知识点总结
神经网络学习笔记3——LSTM长短期记忆网络
stm32 RTC闹钟唤醒低功耗模式
电压继电器SRMUVS-100VAC-2H2D
NLP领域的最新研究进展
VLAN相关知识点
【云筑共创】华为云携手鸿蒙,端云协同,培养创新型开发者
I built another wheel: GrpcGateway
STM32F1 reads MLX90632 non-contact infrared temperature sensor
自定义查询--关于倒排索引的研究
decodeURIComponent()、eval()、encodeURIComponent()
208. 实现 Trie (前缀树)
Database dirty reads, non-repeatable reads, phantom reads and corresponding isolation levels
RandLA-Net复现记录
C语言 — 位运算操作