GitBook: [#2] No subject

This commit is contained in:
Cores
2022-01-07 09:00:01 +00:00
committed by gitbook-bot
parent 456ff183d5
commit fa872a22b7
119 changed files with 4436 additions and 5678 deletions

View File

@ -2,7 +2,7 @@
## 题目链接
[牛客网](https://www.nowcoder.com/practice/4c776177d2c04c2494f2555c9fcc1e49?tpId=13&tqId=11173&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
[牛客网](https://www.nowcoder.com/practice/4c776177d2c04c2494f2555c9fcc1e49?tpId=13\&tqId=11173\&tPage=1\&rp=1\&ru=/ta/coding-interviews\&qru=/ta/coding-interviews/question-ranking\&from=cyc\_github)
## 题目描述
@ -12,7 +12,8 @@
使用一个额外的 minStack栈顶元素为当前栈中最小的值在对栈进行 push 入栈和 pop 出栈操作时同样需要对 minStack 进行入栈出栈操作从而使 minStack 栈顶元素一直为当前栈中最小的值在进行 push 操作时需要比较入栈元素和当前栈中最小值将值较小的元素 push minStack
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/image-20201104013936126.png" width="350px"> </div><br>
![](https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/image-20201104013936126.png)\
```java
private Stack<Integer> dataStack = new Stack<>();