We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Balanced Brackets
Balanced Brackets
Sort by
recency
|
1616 Discussions
|
Please Login in order to post a comment
It can be optimized with regex, but here is a solution that can help solving many balancing issues. the idea is to strip all the valid brackets, till we are left with no valid ones. Solution is in Typescript:
In C language, not using a stack but mimicking it:
Something must be wrong with the compiler, or something is happening behind the scenes. I have some code that is failing 3 cases, but when I unlock the test case and run the input as a custom case it passes just fine.
(I have a correct solution already, but my friend wanted me to try out this other solution)
My C code 😁😎
My Python submission gives RuntimeError or WrongAnswer in most of the test cases. Anyone knows why?