Given a sequence of opening and closing parentheses (“(” and “)”) you will have to determine if it i…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
You do not need stack at all to solve the problem.
Try to find out why your code yields the wrong answer for my input at uDebug.
and these lines,
if(s[i]==')')
else if(s[i]==')(')
I don’t know how your code is working or compiling correctly but you cannot compare a character to a string. and a string must be bound with " " this characters not this ' '. I think you should read about strings more.
Robbing you the joy of solving a problem wouldn’t be better.
These are some of the easier problems on Toph. And, they are very straightforward. Try to think about your solutions first and then code. That way you will end up with simpler code most of the time. And, simpler code is easier to debug.
@Quark.1
You can try to run against the test case I had included in uDebug.
The uDebug button can be found at the top of the problem set(s).
You can also click here.
I think it is not a easy problem anymore. @hjr265 Is there any system to see the testcases? It would be a great help to me if you share the 7th testcases with me. It will help me to find the wrong of my code.
I think if the testcases are more complex, then it should not be in easy catagory anymore.
Some testcases make this problem more harder like: