// TRYING TO PUSH ELEMENT IN STACK WHILE APPENDING THE STRINGBUILDER
if(s.charAt(i)=='('){
if(bracket.size()>0){
sb.append(s.charAt(i));
}
bracket.push(s.charAt(i));
// why this line of code is getting executed when size is greater than 1
}
if(s.charAt(i)=='('){
if(bracket.size()>0){
sb.append(s.charAt(i));
}
bracket.push(s.charAt(i));
//this line of code should not execute when bracket size is greater than 1.
}
当满足 if 条件时,不应执行将元素推入堆栈的名为括号的行。
设置大于0就执行