首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
no.232专题
Leetcode NO.232 Implement Queue Using Stacks 使用栈实现队列
文章目录 1.问题描述2.测试用例示例 1 3.提示4.代码1.入队反转code复杂度 2.出队反转code复杂度 1.问题描述 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、peek、empty): 实现 MyQueue 类: void push(int x) 将元素 x 推到队列的末尾 int pop() 从队列的开头
阅读更多...