Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b21930

Browse files
committed
Update stack_queue.md
1 parent 5e6fd68 commit 7b21930

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

‎data_structure/stack_queue.md‎

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,22 @@
1212

1313
## Stack 栈
1414

15-
[min-stack](https://leetcode-cn.com/problems/min-stack/)
15+
### [/implement-queue-using-stacks](https://leetcode.cn/problems/implement-queue-using-stacks)
16+
> 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、peek、empty):
17+
> 实现 MyQueue 类:
18+
19+
> - void push(int x) 将元素 x 推到队列的末尾
20+
> - int pop() 从队列的开头移除并返回元素
21+
> - int peek() 返回队列开头的元素
22+
> - boolean empty() 如果队列为空,返回 true ;否则,返回 false
23+
> 说明:
24+
> 你 只能 使用标准的栈操作 —— 也就是只有 push to top, peek/pop from top, size, 和 is empty 操作是合法的。
25+
> 你所使用的语言也许不支持栈。你可以使用 list 或者 deque(双端队列)来模拟一个栈,只要是标准的栈操作即可。
26+
27+
28+
29+
30+
### [min-stack](https://leetcode-cn.com/problems/min-stack/)
1631

1732
> 设计一个支持 push,pop,top 操作,并能在常数时间内检索到最小元素的栈。
1833
@@ -61,7 +76,7 @@ public:
6176
*/
6277
```
6378
64-
[evaluate-reverse-polish-notation](https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/)
79+
### [evaluate-reverse-polish-notation](https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/)
6580
6681
> **波兰表达式计算** > **输入:** ["2", "1", "+", "3", "*"] > **输出:** 9
6782
> **解释:** ((2 + 1) \* 3) = 9
@@ -88,7 +103,7 @@ int evalRPN(vector<string>& tokens) {
88103
}
89104
```
90105

91-
[decode-string](https://leetcode-cn.com/problems/decode-string/)
106+
### [decode-string](https://leetcode-cn.com/problems/decode-string/)
92107

93108
> 给定一个经过编码的字符串,返回它解码后的字符串。
94109
> s = "3[a]2[bc]", 返回 "aaabcbc".
@@ -164,7 +179,7 @@ boolean DFS(int root, int target) {
164179
}
165180
```
166181

167-
[binary-tree-inorder-traversal](https://leetcode-cn.com/problems/binary-tree-inorder-traversal/)
182+
### [binary-tree-inorder-traversal](https://leetcode-cn.com/problems/binary-tree-inorder-traversal/)
168183

169184
> 给定一个二叉树,返回它的*中序*遍历。
170185
@@ -194,7 +209,7 @@ vector<int> inorderTraversal(TreeNode* root) {
194209
}
195210
```
196211
197-
[clone-graph](https://leetcode-cn.com/problems/clone-graph/)
212+
### [clone-graph](https://leetcode-cn.com/problems/clone-graph/)
198213
199214
> 给你无向连通图中一个节点的引用,请你返回该图的深拷贝(克隆)。
200215
@@ -221,7 +236,7 @@ Node* clone(Node* node, unordered_map<Node*, Node*>& visited){
221236
}
222237
```
223238

224-
[number-of-islands](https://leetcode-cn.com/problems/number-of-islands/)
239+
### [number-of-islands](https://leetcode-cn.com/problems/number-of-islands/)
225240

226241
> 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。
227242
@@ -267,7 +282,7 @@ for(int i = 0; i < nums.size(); i++){
267282
}
268283
```
269284

270-
[largest-rectangle-in-histogram](https://leetcode-cn.com/problems/largest-rectangle-in-histogram/)
285+
### [largest-rectangle-in-histogram](https://leetcode-cn.com/problems/largest-rectangle-in-histogram/)
271286

272287
> 给定 _n_ 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。
273288
> 求在该柱状图中,能够勾勒出来的矩形的最大面积。
@@ -309,7 +324,7 @@ int largestRectangleArea(vector<int>& heights) {
309324
310325
常用于 BFS 宽度优先搜索
311326
312-
[implement-queue-using-stacks](https://leetcode-cn.com/problems/implement-queue-using-stacks/)
327+
### [implement-queue-using-stacks](https://leetcode-cn.com/problems/implement-queue-using-stacks/)
313328
314329
> 使用栈实现队列
315330
@@ -396,7 +411,7 @@ vector<vector<int>> levelOrder(TreeNode* root){
396411
}
397412
```
398413
399-
[01-matrix](https://leetcode-cn.com/problems/01-matrix/)
414+
### [01-matrix](https://leetcode-cn.com/problems/01-matrix/)
400415
401416
> 给定一个由 0 和 1 组成的矩阵,找出每个元素到最近的 0 的距离。
402417
> 两个相邻元素间的距离为 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /