# 算法养成记：有效括号

LeetCode20

Valid Parentheses 验证括号

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

1.Open brackets must be closed by the same type of brackets.

2.Open brackets must be closed in the correct order.

1.左括号必须用相同类型的右括号闭合。

2.左括号必须以正确的顺序闭合。

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

0 条评论

• ### POJ 2942Knights of the Round Table(tarjan求点双+二分图染色)

Description Being a knight is a very attractive career: searching for the Holy G...

• ### 【Codeforces】1217A - Creating a Character

版权声明：本文为博主原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接和本声明。 ...

• ### 【POJ 3176】Cow Bowling（DP）

The cows don't use actual bowling balls when they go bowling. They each take a n...

• ### LWC 58：724. Find Pivot Index

LWC 58：724. Find Pivot Index 传送门：724. Find Pivot Index Problem: Given an array ...

• ### 洛谷P2870 [USACO07DEC]最佳牛线，黄金Best Cow Line, Gold

题目描述 FJ is about to take his N (1 ≤ N ≤ 30,000) cows to the annual"Farmer of the...

• ### P2880 [USACO07JAN]平衡的阵容Balanced Lineup

题目背景 题目描述： 每天,农夫 John 的N(1 <= N <= 50,000)头牛总是按同一序列排队. 有一天, John 决定让一些牛们玩一场飞盘比赛....

• ### cpuimage 开源之

前年学习opengl做的一个小东西。 原本计划将gpuimage 的算法一个一个转写成cpu版本 c,c++ 版本。 gpuimage 项目参考: https:...