当前位置:网站首页>Summary of one question per day: stack and queue (continuously updated)
Summary of one question per day: stack and queue (continuously updated)
2022-07-02 08:09:00 【Villanelle#】
20. Valid parenthesis disorder map、 Stack 2021/11/21
Given one only includes ‘(’,’)’,’{’,’}’,’[’,’]’ String s , Determines whether the string is valid .
Valid string needs to meet : Opening parentheses must be closed with closing parentheses of the same type . The left parenthesis must be closed in the correct order .
Example :
Input :s = “()[]{}”
Output :true
Input :s = “([)]”
Output :false
Use unordered_map Unordered Association container . Take advantage of the first in and last out nature of the stack , Traversal string , If ([{ Then push it onto the stack , Otherwise )]}, See whether the element at the top of the stack is its corresponding value , If yes, pop up the stack top element , Finally, if the stack is empty after traversal, it is regarded as valid .
class Solution {
public:
bool isValid
边栏推荐
- Using super ball embedding to enhance confrontation training
- JVM instructions
- 【C#笔记】winform中保存DataGridView中的数据为Excel和CSV
- 【学习笔记】Matlab自编图像卷积函数
- WCF更新服务引用报错的原因之一
- How gensim freezes some word vectors for incremental training
- Carsim-问题Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
- CVPR19-Deep Stacked Hierarchical Multi-patch Network for Image Deblurring论文复现
- Network metering - transport layer
- 针对tqdm和print的顺序问题
猜你喜欢
OpenCV3 6.3 用滤波器进行缩减像素采样
【MagNet】《Progressive Semantic Segmentation》
SQLyog远程连接centos7系统下的MySQL数据库
浅谈深度学习模型中的后门
Eklavya -- infer the parameters of functions in binary files using neural network
Array and string processing, common status codes, differences between PHP and JS (JS)
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
Principes fondamentaux de la théorie musicale (brève introduction)
【Batch】learning notes
How to wrap qstring strings
随机推荐
深入理解JVM
关于原型图的深入理解
力扣每日一题刷题总结:字符串篇(持续更新)
SQLyog远程连接centos7系统下的MySQL数据库
樂理基礎(簡述)
将恶意软件嵌入到神经网络中
One book 1078: sum of fractional sequences
OpenCV 6.4 中值滤波器的使用
针对tqdm和print的顺序问题
包图画法注意规范
Go functions make, slice, append
Sqlyog remote connection to MySQL database under centos7 system
多站点高可用部署
Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
高中数学必修一
Specification for package drawing
My VIM profile
利用超球嵌入来增强对抗训练
CVPR19-Deep Stacked Hierarchical Multi-patch Network for Image Deblurring论文复现
常量指针和指针常量