These shorts are amazing. Keep them coming! You are helping us all remain mentally alert.
A little proud of myself for thinking of this solution on my own. It’s small but a sign that I’m getting better
I am loving these shorts, and when they’re ones I have done before it’s 😻😻
I don't have time to play these games with programming, but I do enjoy the content. I also enjoy code editors that highlight the matching parentheses.
Thank you for these vids neetcode, I had a problem similar to this recently and having watched this video really helped. Thank you for saving YouTube shorts brainrot, I make sure to always watch these videos all the way through when they pop up
I believe Map[c] would be close_to_open[c]
Good solution :) you essentially just explained the utility of a Push-Down Automaton in a scenario like this without letting the message get obscured to beginners by the heavy-handed jargon that would otherwise naturally come with Theory of Computation concepts like automata.
keep a stack of open parentheses. see an opening one, add it to the stack. see a closing one, pop the top off the stack and check if it's the opening counterpart to the closing one you are seeing. if it's not, or if the stack is empty, return False. if you get through the whole string and the stack is empty by the end, return True. if there are still some values on the stack, return false.
Very simple and elegant solutions. thank you :o
Quick correction: The singular of parentheses is parenthesis, the pronunciations are identical.
I have seen this problem before , ended up writing array fuckery I didn’t know the data structure yet at the time
For more context, this is Dyck language which can be represented by context-free grammar which can be transformed into push down automata (which might inspire the solution for this problem).
How do people learn all this ???
What language is that
Nice
Great tip!
Why test 99( where s = "[([]])" ) Output is true?
For the close_to_open dictionary, why couldn’t you have done open to close?
nice explanation
@aparnachand5126