Loading...
Given a string s containing only the characters '(', ')', '{', '}', '[' and ']', return whether s is valid.
s
'('
')'
'{'
'}'
'['
']'
An input string is valid if:
Input: s = "()" Output: true
Input: s = "()[]{}" Output: true
Input: s = "(]" Output: false
s.length
Click "Run" to test with sample cases or "Submit" to run all tests.