Matched Brackets Weird Test Case (ZCO12001)

Okay, so I was able to understand the logic to solve the problem Matched Brackets and I got all test cases correct…except EXACTLY ONE which gives TLE. I cannot understand what is wrong with my code. Here is the solution link and the problem link is given previously. Any help greatly appreciated.

@overlxrd Same is happening with me and i am trying from 2 days.
Have you got any solution to it?

Link to your solution?

Edit:

I doubt anyone cares anymore, but the OP’s solution times out given a testcase consisting of 50000 1’s followed by 50000 2’s.

Of course people care. Thanks for this. Are you the setter by any chance?

1 Like

Well, it’s been over seven months XD

Oh, no - I don’t know who “admin3” is.

Hey man, it was really nice to get your help. Are you on discord? If you are interested I would like to be in touch with you. It is okay if you aren’t comfortable.