当前位置:网站首页>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
边栏推荐
- A brief analysis of graph pooling
- Rhel7 operation level introduction and switching operation
- One book 1078: sum of fractional sequences
- Matlab数学建模工具
- CarSim problem failed to start solver: path_ ID_ OBJ(X) was set to Y; no corresponding value of XXXXX?
- Array and string processing, common status codes, differences between PHP and JS (JS)
- Global and Chinese market of snow sweepers 2022-2028: Research Report on technology, participants, trends, market size and share
- Sparse matrix storage
- C语言的库函数
- 包图画法注意规范
猜你喜欢
Correction binoculaire
Carsim-路面3D形状文件参数介绍
[learning notes] matlab self compiled image convolution function
Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?
樂理基礎(簡述)
Matlab数学建模工具
Jetson nano installation tensorflow stepping pit record (scipy1.4.1)
简易打包工具的安装与使用
Open3d learning note 3 [sampling and voxelization]
[binocular vision] binocular correction
随机推荐
Multi site high availability deployment
针对tqdm和print的顺序问题
多站点高可用部署
服务器的内网可以访问,外网却不能访问的问题
SQL操作数据库语法
E-R draw clear content
Open3d learning notes II [file reading and writing]
Correction binoculaire
【MobileNet V3】《Searching for MobileNetV3》
[C # note] the data in DataGridView saved in WinForm is excel and CSV
One book 1078: sum of fractional sequences
Several methods of image enhancement and matlab code
Remplacer l'auto - attention par MLP
Erase method in string
Go functions make, slice, append
Eklavya -- infer the parameters of functions in binary files using neural network
Prompt 范式简述
力扣方法总结:滑动窗口
稀疏矩阵存储
Media query usage