微信公众号:特里斯丹
这里我们有梦
关于文学,关于爱情
关于穿越世界的旅行
github:
https://github.com/weidafeng/LeetCode_Python
这是每周刷LeetCode系列的第6篇笔记
第6周 20. Valid Parentheses [Easy]
https://leetcode.com/problems/valid-parentheses/
Given a string containing just the characters , , , , and , determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Example 1:
Input:"()"Output:true
Example 2:
Input:"()[]{}"Output:true
Example 3:
Input:"(]"Output:false
Example 4:
Input:"([)]"Output:false
Example 5:
Input:"{[]}"Output:true
提交记录:
github里补充介绍了 python实现栈的相关知识,欢迎star
专栏介绍
1、本专栏是我刷LeetCode的学习笔记,每周更新一次
2、所有代码均已上传至github,欢迎star、watch:
https://github.com/weidafeng/LeetCode_Python
3、python语言实现,至少用两种思路,争取用最简洁的代码实现
4、欢迎指正、讨论
如果帮到你了
欢迎点赞+分享
感谢