Help me with this redundant parenthesis question


test case is satisfying but it is showing wrong answer help please

Dhruv your logic is little bit wrong, plz refer to this piece of code for changes that you need to make in your code…
else
{
if(!s.empty())
{
if(ch==’)’)
{
char top=s.top();
if(s.top()==’(’)
{
return true;
}
else
{
while(s.top()!=’(’ && !s.empty())
{
s.pop();
}
s.pop();
}
}