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.
1.递归:stack overflow
1 | public class Solution { |
2.堆栈
1 | public class Solution { |