当前位置:网站首页>[sword finger offer] 42 Stack push in and pop-up sequence
[sword finger offer] 42 Stack push in and pop-up sequence
2022-07-07 10:15:00 【percation】
The first question of rehabilitation training , I deeply feel that there is another dish , It's already very delicious
class Solution {
public:
bool isPopOrder(vector<int> pushV,vector<int> popV) {
if(popV.size() != pushV.size()) return false;
stack<int> s;
int idx = 0;
for(int i = 0; i < pushV.size(); i++){
s.push(pushV[i]);
while(!s.empty() && (s.top() == popV[idx])){
s.pop();
idx++;
}
}
if(s.empty() == true) return true;
return false;
}
};
边栏推荐
- Programming features of ISP, IAP, ICP, JTAG and SWD
- Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT
- Download Text, pictures and ab packages used by unitywebrequest Foundation
- Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software
- Arcgis操作: 批量修改属性表
- ES6中的函數進階學習
- Guid主键
- Pdf document signature Guide
- How to cancel automatic saving of changes in sqlyog database
- ORM--数据库增删改查操作逻辑
猜你喜欢
LLVM之父Chris Lattner:為什麼我們要重建AI基礎設施軟件
ORM -- query type, association query
Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT
How to cancel automatic saving of changes in sqlyog database
Leetcode exercise - 113 Path sum II
【剑指Offer】42. 栈的压入、弹出序列
ArcGIS operation: batch modify attribute table
Pdf document signature Guide
arcgis操作:dwg数据转为shp数据
Fiddler simulates the interface test
随机推荐
Weekly recommended short videos: what are the functions of L2 that we often use in daily life?
Performance optimization record of the company's product "yunzhujia"
Appx代码签名指南
Do you have a boss to help look at this error report and what troubleshooting ideas are there? Oracle CDC 2.2.1 flick 1.14.4
Methods of adding centerlines and centerlines in SolidWorks drawings
SolidWorks工程图中添加中心线和中心符号线的办法
Chris Lattner, père de llvm: Pourquoi reconstruire le logiciel d'infrastructure ai
Win10安装VS2015
Postman interface test VII
Flinkcdc failed to collect Oracle in the snapshot stage. How do you adjust this?
Pdf document signature Guide
学习记录——高精度加法和乘法
Before joining the chain home, I made a competitive product analysis for myself
Apprentissage avancé des fonctions en es6
HAL库配置通用定时器TIM触发ADC采样,然后DMA搬运到内存空间。
ORM--逻辑关系与&或;排序操作,更新记录操作,删除记录操作
The landing practice of ByteDance kitex in SEMA e-commerce scene
ES6中的原型对象
LeetCode 练习——113. 路径总和 II
AHB bus in stm32_ Apb2 bus_ Apb1 bus what are these