Redundant parenthesis

https://ide.geeksforgeeks.org/kMXgjlkswL
what is the problem in my code

Hey @anitagupta1411

if (ch == ')') { 
                // pop character from the stack  
                char top = Stack.peek(); 
                Stack.pop(); 

                // stores the number of characters between a  
                // closing and opening parenthesis  
                // if this count is less than or equal to 1  
                // then the brackets are redundant else not  
                int elementsInside = 0; 
                while (top != '(') { 
                    elementsInside++; 
                    top = Stack.top(); 
                    Stack.pop(); 
                } 
                if (elementsInside < 1) { 
                    return true; 
                } 
            } // push open parenthesis '(', operators and  
            // operands to stack  
            else { 
                Stack.push(ch); 
            } 

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.