胶水代码,存在优化的空间
import java.util.Stack; class Solution { public boolean isValid(String s) { Stack<Character> stack = new Stack<>(); for(int i=0; i < s.length(); i++){ char c = s.charAt(i); if(c == '(' || c == '{' || c == '[' || stack.size() == 0){ stack.push(c); }else{ char peek = stack.peek(); if(c == ')'){ if(peek == '(')