Find String Contains Valid Parentheses or Not
boolean isValid(String str) { Stack<Character> st=new Stack<Character>(); for(char ch:str.toCharArray()) { if(ch=='['||ch=='('||ch=='{') { st.push(st); }else if(ch==')'&&!st.isEmpty()&&st.peek()=='('){ st.pop(): }else if(ch=='}'&&!st.isEmpty()&&st.peek()=='}'){ st.pop(): }else if(ch=='}'&&!st.isEmpty()&&st.peek()=='{'){ st.pop(): }else{ return false; } } return st.isEmpty(); }