← 返回 walmartlabs 的题目列表Variant of Parentheses Matching
类型:online_judge
Problem: Parentheses Matching (Variant)
Given a string s consisting only of bracket characters (e.g., from ()[]{}, exact types depend on the prompt), determine whether the brackets are properly matched.
The string is considered valid if and only if:
Every opening bracket is closed by the same type of closing bracket.
Brackets are closed in the correct nested order (the most recent opening bracket must be closed first).
Return true if the string is valid, otherwise return false.
Constraints
1 <= |s| <= 2 * 10^5
Examples
Input: "()[]{}" Output: true
Input: "(]" Output: false
Input: "([)]" Output: false
Input: "{[]}" Output: true
Example
Input
()[]{}
Output
true