Valid Parentheses

Easy
StringStackAmazonMicrosoft
Given a string containing only the characters `()[]{}`, print whether the brackets are valid. Brackets are valid when every opening bracket is closed by the same type in the correct order. Input format: - One line: s Print `true` or `false`.

Constraints

1 <= s.length <= 10^5
s consists only of the characters ()[]{}.

Sample tests

Sample 1

Sample 2

Sign in to submit