#20

Valid Parentheses

pupil · 470 · lc easy +26 · verified · 43.8% accepted · 27,653 likes · top 25%

play →

Description

String s contains only '(', ')', '{', '}', '[', and ']'. Return whether the brackets are valid: every opener must be closed by the matching bracket type in correct nesting order, and every closer must correspond to an unmatched opener.

Code

1
2
3