LONGEST VALID PARENTHESIS | LEETCODE # 32 | PYTHON OPTIMAL SOLUTION

preview_player
Показать описание
In this video we are solving yet another fun parenthesis based question: Longest Valid Parenthesis.

Despite being marked a Hard level question, this one isn't actually that bad. There's only one small thing you need to realize in order to figure this one out and this is one of those problems that once you see it once, it's so intuitive as to how the solution works you can easily remember it in an interview setting.

If you are enjoying the content I'm producing and would like to see more, please consider dropping a subscription to my channel! It really helps me grow and will help you get into FAANG and all the perks that come with that!
Рекомендации по теме
Комментарии
Автор

you say this isnt actually hard haha but what i find hard is finding the intuition that tells us thatt we may have missed some valid parenthesis when we parse it only from left tor right. the left, right pointers is not the hard bit understand, the right to left parsing is.

samuraijosh
Автор

instead of saying that a right to left parsing is required, you should have given an example for the same; it helps in understanding the logic better

harshal
Автор

Happy to see this channel growing :) way to go. It would also be nice to see a video like how we can tackle DSA for each company in FAANG like do we have to just do top100 for company tagged leetcode or the videos you mention with company tag or they do a variation on them

preityhansaa
Автор

nice video but you can provide better explanation for why right to left pass is needed. also there's one more algo using stack, try to cover multiple algorithms for better understanding :)

impatientgaming
Автор

Give a example of (() is not hard when you tried to explain why we need to do right to left to double check as well

Tiecongli
Автор

solution itself is easy to understand but i'm still not understanding a input case where going reverse order is needed..

shawnpark
Автор

@5:45 you clearly do not know which use cases both left and right traversal would be useful, if you knew, you would have shown an example :)

DrewRanger
Автор

he didn't give a test case that shows that parsing from right to left is required so here's one:

"(()"

krishivgubba
Автор

Change the channel name to 'Cracking FAANG without UNDERSTANDING'

fahimahmednafis