//I am getting WA , please check
public static boolean redundant(String str){
Stack s=new Stack<>();
int count=0;
for(int i=0;i<str.length();i++){
char ch=str.charAt(i);
if(ch==’)’&&!s.isEmpty()){
count=0;
while(s.peek()!=’(’){
count++;
s.pop();
}
s.pop();
if(count<1){
return true;
}
}
else{
s.push(ch);
}
}
return false;
}
