leet++Valid Parentheses
EasyStackString

Valid Parentheses

Given a string made only of bracket characters, decide whether every opening bracket is closed by the matching type in the correct nested order.

Examples

Input: text = "{[()]}"

Output: true

Each pair closes in reverse order of opening.

Input: text = "([)]"

Output: false

The closing bracket types do not match the nesting order.

Constraints & goals

  • The input contains only (), [], and {} characters.
  • An empty string is valid.

Camera feed

Preview
Camera starts when the session begins
Read-only

Transcribed whiteboard text will appear here.