leetcode [#20] | GCidea's blog
目录1. 题目2. 解决方案3. 注意事项
题目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.
解决方案12345678910111213141516171819202122232425262728293031323334353637383940public class Solution { public boolean isValid(String s) { char[] sArr = s.toCharArray(); Stack<String> stack = new Stack<>(); boolean result = true...阅读全文
题目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.
解决方案12345678910111213141516171819202122232425262728293031323334353637383940public class Solution { public boolean isValid(String s) { char[] sArr = s.toCharArray(); Stack<String> stack = new Stack<>(); boolean result = true...阅读全文