Problems

Valid Parentheses

Valid Parentheses

Easy
StringStackAcceptance 41.1%

Given a string `s` containing just the characters '()[]{}', determine if the input string is valid. An input string is valid if open brackets are closed by the same type of brackets in the correct order.

Example 1
Input: s = "()[]{}"
Output: true
Example 2
Input: s = "(]"
Output: false

Constraints

  • 1 <= s.length <= 10^4
  • s consists of bracket characters only.
solution.js
JavaScript (Node 20)
Loading...
Run or submit your code to see results here.