Problems

2. Valid Parentheses

EasyStackAmazonMicrosoft

Given a string s containing only bracket characters, determine whether the brackets are valid.

Example 1:

Input: s = "()"
Output: true

Example 2:

Input: s = "([)]"
Output: false

Constraints:

  • 1 <= s.length <= 10^4
Core code mode
● Auto-savedLine 1, column 1