学习
实践
活动
专区
工具
TVP
写文章

LeetCode笔记 20.Valid ParenthesesEasy

微信公众号:特里斯丹

这里我们有梦

关于文学,关于爱情

关于穿越世界的旅行

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、欢迎指正、讨论

如果帮到你了

欢迎点赞+分享

感谢

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20190101G0GK8700?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

关注

腾讯云开发者公众号
10元无门槛代金券
洞察腾讯核心技术
剖析业界实践案例
腾讯云开发者公众号二维码

扫码关注腾讯云开发者

领取腾讯云代金券