Given a string s containing only the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The string is valid if open brackets are closed by the same type of brackets in the correct order.
s = parentheses string
return true if the string is valid, otherwise false
Example 1:
Input:
s = "()[]{}"Output:
true
Explanation:
All types of brackets are correctly matched in order.
Example 2:
Input:
s = "([)]"
Output:
false
Explanation:
Brackets are incorrectly nested.