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.
This question is very simple, but it has many pitfalls.
public class Solution { public boolean isValid(String s) { Stack q = new Stack(); for(int i = 0; i This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:
Original author:Jake Tao,source:"LeetCode – 20. Valid Parentheses"