https://leetcode.com/problems/valid-parentheses/

Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.

The brackets must close in the correct order,"()"and"()[]{}"are all valid but"(]"and"([)]"are not.

数据结构stack 经典例题...

这题本质就是对于当前右括号查看一下离它最近的左括号是不是match,如果是就不用管他们了继续查,如果不是就是不match

查最近历史的 ==> stack (like 浏览器后退)

results matching ""

    No results matching ""