首页
学习
活动
专区
工具
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元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券