Valid Parentheses
Valid Parentheses
Given a string containing only the characters ()[]{}, determine if the input string is valid.
A string is valid if:
- Open brackets are closed by the same type of brackets.
- Open brackets are closed in the correct order.
Function signature
func IsValidParentheses(s string) bool
Example
s = "()[]{}"
output = true
Constraints
- 0 <= len(s) <= 200_000
Notes
- Use a stack of opening brackets.
Run tests to see results
No issues detected