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
- Discussions
Balanced Brackets
Balanced Brackets
Sort by
recency
|
233 Discussions
|
Please Login in order to post a comment
C++ O(n)
the idea:
}(){
The code:
Using a stack is unnecessary. We can simply match pairs of brackets using Regex and remove them from the string until the string is gone. If we ever don't find a match or if the string length is not an even number we can return 'NO'
Here's a Javascript solution:
Tried it again. I don't know why but I got better without coding for two days. Well C# at least. I was still making a website for the past 2 days. It's now 100%
How the hell is this wrong?