Valid Parentheses | Leetcode

preview_player
Показать описание

In case you are thinking to buy courses, please check below:

Watch at 1.25x for better experience ..

---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

#dsa​ #striver #leetcode
Рекомендации по теме
Комментарии
Автор

DSA playlist links in the description ..
.
How's the consistency .. ?

takeUforward
Автор

Dang I feel dumb af for not thinking of this.

TheStrafendestroy
Автор

God level explanation as always bhaiya...
just one correction : We should declare stack of characters as stack<char>s. instead of stack<int>s...

abhishekdhok
Автор

I feel so lucky to have a person like you as a teacher

blitzkrieg
Автор

you are the boss of DSA i have searched and not found to like this understandable concept thank you

yohannesalemu
Автор

Bhagwan apko sundar si biwi de, apke maa baap sada kush rahe sukhi rahi 🙏🙏🙏🙏🙏🙏🙏. Thank you for your god level explanation.

dipendersingh
Автор

Very nice and clear explanation thankyou so much 🙏🏼🙏🏼🙏🏼

someshsahu
Автор

Update the problem link in the description.

gautamsuthar
Автор

Understood. Thanks a lot bhaiya for putting up ur efforts and helping all of us!!

ashokdurunde
Автор

crystal clear explanaton!!
thank you bhaiya

aasthajha
Автор

Awesome video, keep up the incredible work! :)

ComputerScienceSimplified
Автор

Plsss launch leetcode or any dsa sheet

hustleundersky
Автор

I think problem link is not correctly mentioned

ShubhamMahawar_Dancer_Actor
Автор

What about this "[{]}". Is this balanced?

SarathKumar-izzx
Автор

thanks
for this video and wonderful explanation

gauravsrivastava
Автор

What if you didn't write the code down

carlstewart
Автор

Sir coding ninja ka app support kr rhe Maine course lekha rakah hai already DSA ka but kissi bhi teacher ne aapse aacha nhi padhaya hai

dishant
Автор

1st line stack<char> st; correction

hustleundersky
Автор

"Whenever theres a opening make sure you put it in" Striver, 2021

raunak
Автор

I did one solution with unordered_map which makes the code a bit simple-

bool isValid(string s) {
stack<char> st;
unordered_map<char, char> mp = {{'(', ')'}, {'{', '}'}, {'[', ']'}};
for(char c: s) {
if(mp.find(c) != mp.end()) {
st.push(c);
} else if(!st.empty() && mp[st.top()] == c) {
st.pop();
} else {
return false;
}
}

return st.empty();
}

zangruver