Valid Parentheses
EasyStack
Given a string s containing only the characters (, ), {, }, [ and ], determine if the input string is valid. A string is valid if open brackets are closed by the same type and in the correct order.
Example:
Input: s = "()[]{}"
Output: true
Constraints:
- •
1 <= s.length <= 10^4 - •
s consists of parentheses only: (){}[]
Valid Parentheses
EasyStack
Given a string s containing only the characters (, ), {, }, [ and ], determine if the input string is valid. A string is valid if open brackets are closed by the same type and in the correct order.
Example:
Input: s = "()[]{}"
Output: true
Constraints:
- •
1 <= s.length <= 10^4 - •
s consists of parentheses only: (){}[]
Press Run or Ctrl+Enter to execute