Valid Parentheses

原题&翻译

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
给出括号字符串, 确认左右匹配是否正确

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.

  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

Example 1:


Hello world!
文章已创建 218

相关文章

开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。

返回顶部