20. Valid Parentheses(括号)
来源:互联网 发布:听相声的软件 编辑:程序博客网 时间:2024/06/03 15:14
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
如下:
class Solution {public: bool isValid(string s) { stack<char> st; for(auto c : s){ if(c == '(') st.push(')'); else if(c == '[') st.push(']'); else if(c == '{') st.push('}'); else { if(st.empty() || st.top() != c) return false; st.pop(); } } return st.empty(); }};
0 0
- 20. Valid Parentheses(括号)
- LeetCode 20. Valid Parentheses(括号校验)
- 20. Valid Parentheses (括号匹配)
- 20.Valid Parentheses (括号匹配)
- LeetCodet题解--20. Valid Parentheses(括号匹配问题)
- 20. Valid Parentheses--合法的括号组合(使用stack)
- Leetcode#20. Valid Parentheses(有效括号-栈)
- 20. Valid Parentheses(有效括号) —— Java
- 20.Valid Parentheses&合法括号序列判断
- LeetCode | Valid Parentheses(括号匹配)
- 【LeetCode】- Valid Parentheses(有效的括号)
- Valid Parentheses --括号匹配
- Valid Parentheses 括号配对
- Valid Parentheses 有效括号
- Valid Parentheses 合法括号
- Valid Parentheses:括号匹配
- 【leetcode】括号符匹配问题(Parentheses):Valid Parentheses|Generate Parentheses|LongestValid Parentheses
- leetcode Valid Parentheses 有效括号
- vmware 端口映射
- MAMP PRO 4.1.1 破解
- UVALive 4593 Exclusive Access 2(状压dp)
- mac上npm包的安装路径
- 杭电2535之vote
- 20. Valid Parentheses(括号)
- 类的静态成员函数和静态成员变量
- Java+Tomcat+MySQL实现简单的网页注册和登录
- 我發佈的APP:kaka(手机咖),一個快速找到兼職工作的平台!
- 训练13-HTML 设置标签的字体样式
- Anaconda多环境多版本python配置指导
- 子网划分及子网掩码计算方法
- 第二周
- 如何在github上传自己的项目