Hey everyone,
I was solving Matched Brackets problem from DSA learning series (week 2)
Problem Link : CodeChef: Practical coding for everyone
I solved it using stacks , and I am getting correct answer for sample input, but its not passing all the cases . I tried some more examples , they are giving correct answers.
I am not understanding in which case can my code gives incorrect answer.
( Also, the problem lies in finding depth. I have seen editorial , where they decreased depth value when “)” is encountered, but I am not getting why my approach is failing
Any help would be appreciated)