please check the code.
sir , i am stuck in this problem . How do i check for the conditions.
Generating Parenthesis Problem
hello @Pramod123
in ur check function use single variable say a.
intitalise it with zero.
start iterating ur string from i=0 to i=n-1.
{ if out[i]==’(’ then a++
else a- -
if(a<0)
return false;
}
if a!=0
return false
otherwise return true
Its not working sir… not getting any output if i do if (a!=0) return false ; but when i do return true ; it give results but not what the problem need
pls share ur updated code