LeetCode p20 Valid Parentheses 题解
1.题目:
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.
题意:
判断一个字符串内的所有括号是否搭配得当。
2.解题思路:
使用栈匹配
3.代码
1 |
|