← All problemsSign in to save submissions
Valid Parenthesesmedium
Given a string s containing only the characters (, ), {, }, [, ], determine if the input string is valid.
An input string is valid if:
- Open brackets are closed by the same type.
- Open brackets are closed in the correct order.
- Every close bracket has a corresponding open one.
Example
Input: "()[]{}"
Output: true
Input: "(]"
Output: false
Run your code to see test results.