← 返回 meta 的题目列表Bracket Matching
类型:online_judge
Problem Description
Given a string containing three types of parentheses: [], {}, and (), write a function to determine if the given parentheses are valid.
A string is considered valid if:
An empty string is valid
Open brackets are closed in the correct order and the correct type
Input
s: A string containing only the three types of brackets, with a length ranging from 0 to 1000.
Output
A boolean value indicating whether the brackets are valid.
Example
Input: "some string"
Output: True
Input: "[abc(def)gc{i}j]"
Output: True
Input: "[abcdef"
Output: False
Example
Input
""