auto commit
This commit is contained in:
parent
c29021befd
commit
4b11ab58bb
@ -1,6 +1,8 @@
|
||||
# 31. 栈的压入、弹出序列
|
||||
|
||||
[NowCoder](https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
## 题目链接
|
||||
|
||||
[牛客网](https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
|
||||
## 题目描述
|
||||
|
||||
@ -10,7 +12,7 @@
|
||||
|
||||
## 解题思路
|
||||
|
||||
使用一个栈来模拟压入弹出操作。
|
||||
使用一个栈来模拟压入弹出操作。每次入栈一个元素后,都要判断一下栈顶元素是不是当前出栈序列 popSequence 的第一个元素,如果是的话则执行出栈操作并将 popSequence 往后移一位,继续进行判断。
|
||||
|
||||
```java
|
||||
public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
|
||||
@ -33,4 +35,5 @@ public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
|
||||
|
||||
|
||||
|
||||
|
||||
<div align="center"><img width="320px" src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/githubio/公众号二维码-2.png"></img></div>
|
||||
|
@ -1,6 +1,8 @@
|
||||
# 31. 栈的压入、弹出序列
|
||||
|
||||
[NowCoder](https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
## 题目链接
|
||||
|
||||
[牛客网](https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106?tpId=13&tqId=11174&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
|
||||
## 题目描述
|
||||
|
||||
@ -10,7 +12,7 @@
|
||||
|
||||
## 解题思路
|
||||
|
||||
使用一个栈来模拟压入弹出操作。
|
||||
使用一个栈来模拟压入弹出操作。每次入栈一个元素后,都要判断一下栈顶元素是不是当前出栈序列 popSequence 的第一个元素,如果是的话则执行出栈操作并将 popSequence 往后移一位,继续进行判断。
|
||||
|
||||
```java
|
||||
public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
|
||||
@ -33,4 +35,5 @@ public boolean IsPopOrder(int[] pushSequence, int[] popSequence) {
|
||||
|
||||
|
||||
|
||||
|
||||
<div align="center"><img width="320px" src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/githubio/公众号二维码-2.png"></img></div>
|
||||
|
Loading…
Reference in New Issue
Block a user