当前位置:网站首页>【剑指Offer】42. 栈的压入、弹出序列
【剑指Offer】42. 栈的压入、弹出序列
2022-07-07 07:46:00 【percation】
康复训练第一题,深深地感觉又菜了,本来就很菜了
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;
}
};
边栏推荐
- Huffman encoded compressed file
- Win10 installation vs2015
- phpcms实现PC网站接入微信Native支付
- Parameter sniffing (2/2)
- ORM -- database addition, deletion, modification and query operation logic
- Arcgis操作: 批量修改属性表
- Codeforces - 1324d pair of topics
- Advanced function learning in ES6
- Methods of adding centerlines and centerlines in SolidWorks drawings
- Internship log - day04
猜你喜欢

企业实战|复杂业务关系下的银行业运维指标体系建设

VS Code指定扩展安装位置

Web3.0 series distributed storage IPFs

SolidWorks工程图中添加中心线和中心符号线的办法

ORM--查询类型,关联查询

一文讲解单片机、ARM、MUC、DSP、FPGA、嵌入式错综复杂的关系

Google Colab装载Google Drive(Google Colab中使用Google Drive)

The physical meaning of imaginary number J

Chris LATTNER, the father of llvm: why should we rebuild AI infrastructure software

能源路由器入门必读:面向能源互联网的架构和功能
随机推荐
AI moves from perception to intelligent cognition
ES6中的函數進階學習
Pytest learning - dayone
喜马拉雅网页版每次暂停后弹窗推荐下载客户端解决办法
phpcms实现PC网站接入微信Native支付
[ORM framework]
[learning notes - Li Hongyi] Gan (generation of confrontation network) full series (I)
Horizontal split of database
request对象对请求体,请求头参数的解析
Parameter sniffing (2/2)
C socke server, client, UDP
In addition to the objective reasons for overtime, what else is worth thinking about?
STM32基础知识—内存映射
Postman tutorial - scripting
Please ask me a question. I started a synchronization task with SQL client. From Mysql to ADB, the historical data has been synchronized normally
企业实战|复杂业务关系下的银行业运维指标体系建设
【ORM框架】
Bean 作⽤域和⽣命周期
Guys, have you ever encountered the case of losing data when Flink CDC reads mysqlbinlog? Every time the task restarts, there is a probability of losing data
A wave of open source notebooks is coming
