Balanced Brackets Matching: Easiest Code using Stack | CP Course | EP 31
HTML-код
- Опубликовано: 2 авг 2024
- C++ STL TUTORIALS : • C++ STL | Competitive ...
FREE COMPETITIVE PROGRAMMING COURSE TUTORIALS : • Competitive Programmin...
FOR DOUBTS AND DISCUSSIONS, JOIN DISCORD : / discord
In this video I discuss How you can check if a given String of parentheses or brackets is a balanced string or not using Stacks in C++ STL
Hackerrank Question : www.hackerrank.com/challenges...
Timestamps:
Logic explanation : (0:00)
Code using Stack: (7:46)
Bloopers : (17:11)
Be a part of our awesome Community. Join
○ Discord : / discord
○ Telegram : t.me/LuvIsMeYT
You can follow me on below platforms for all the latest updates
○ Instagram : / i._m_.luv
○ Twitter : / luvk1412
○ Linkedin : / luvk1412
Blog(Not frequently updated)
○ Blog : www.codewithluv.in
Hashtags
#brackets #parentheses #matching #stack #tutorial #competitivecoding
17:23 bhaiya I was literally watching this episode at that same time 😂, goosebumps aa gye the jesei aapne same time bataya.
Hats off to your dedication. Very inspiring 💙
10:30 Now this is what I came for and this is what makes your video unique and better than everyone... can't thank you enough ❤️️❤️️❤️️
we can use pair instead of unordered map also ??
@@piyushgarg511 I think no.Because in case of map we can access value with key(map[key1]+map[key2]==0 or not). But in case of pair we can't do that.
@@piyushgarg511 yes we can
pair p[3] = {{'[',']'},{'(',')'},{'{','}'}};
string isBalanced(string s) {
stack bracket;
for(auto i = s.begin();i!=s.end();i++){
if(*i=='{' || *i == '['||*i=='('){
bracket.push(*i);
}else if(bracket.empty()){
return "NO";
}else if(*i==p[0].second && bracket.top()==p[0].first){
bracket.pop();
}else if(*i==p[1].second && bracket.top()==p[1].first){
bracket.pop();
}else if(*i==p[2].second && bracket.top()==p[2].first){
bracket.pop();
}else return "NO";
}
if(bracket.empty()) return "YES" ;
else return "NO" ;
}
By seeing your competitive programming playlist.
I can't give excuses to myself for not learning Computitve programming.
Thank you bhai 😍😍😘😘😘😘
This is the best++++ channel for programming (not only for competitive programming).
Bs afsoos ye hai ki jaha paisa dete hai (college) waha Aisa content nhi milta .
👏❤️❤️
This is just to let you know that this is the first time when someone has explained me "how to code" with such clarity! I am really very amazed and motivated today because of this video playlist.
thank you luv sir
Lol.. I missed the last blooper part !😂
Man ! I can't believe you are an engineer and @ 4 am you are teaching us. If we can't like, comment, share and most importantly learn from your amazing contents, this will be so so unfair.
❤❤❤❤❤ Hope one day I can meet you !!!🙏🙏🙏
I am pretty sure that this channel will grow exponentially because of having Amazing content
thanks for creating such an informative playlist , i have shared this with my friend so that they too could understand stl in the most easiest way.
Love your way of solving it differently sir !!
Brroooo,I was waiting for this 🔥🔥❤️
I never loved c++ but after your video i fall in luv with c++ with luv❤️
I love content of this channel very very helpful and no one gives this level of content
Awesome approach Bro!! Much appreciated.
I was about to quit competitive programming but after start watching your course I started to take part in contest going on and currently 2* coder at codeshef thanks a lot luv bhai.
HOW R U NOW ? any did you improve more?
loved the way how easy you made this question😍😍
I Madara Uchiha , declare you the bestest teacher ever :)
Wake up to reality....
@@AnoNymOuS-mg9oj then you suggest some?
naruto ko dekha
He doesn't even remember your name, a fitting end perhaps
Best itself is superlative
showing segmentation core dumped
#include
using namespace std;
#define pb push_back
#define pp pop_back
#define f first
#define s second
#define REP(i, a, b) for (int i=a; i m={{'[',1},{'{',2},{'(',3},{']',-1},{'}',-2},{')',-3}};
string check(string &st)
{
stack w;
for(char bracket: st)
{
if(m[bracket]>0) w.push(bracket); //if opening bracket
else
{
if (st.empty()) return "NO";
int a=m[bracket];
char topmost=w.top();
int b=m[topmost];
if(a+b!=0) return "NO";
else w.pop();
}
}
if (w.empty()) return "YES";
else return "NO";
}
int main()
{
int t;cin>>t;
while(t--)
{
string s; cin>>s ;
cout
Thanks a lot for this playlist!
such an elegant code! :D wow❤️️
bhaiya thanks for the content .and especially jo aap questions add kr dete hain saari videos ke baad haclkerrank ya codeforced ki ,thath"s helping a lot in practising
great approach and explanation 👌
bloopers are fun.....do include them.
And your content obviously is best.
Masterpiece, Love from Bangladesh....😍😍😍😍😍😍
awesome bro i saw this problem & solution multiple time but this solution is pretty more better
Your explanation are really rock. Thank you soo much😊😊
You are doing a great work broo..🔥
And again you rocked it bro!!
salute to see your hardwork bhiya , and thanks for the playlist . ❤
Luv Bhaiya you are simply amazing
Can't thankyou much for the course......
Par loving this.....
And your efforts are awesome
Appreciable ♥️
BEST !! CP course
thank you so much for such videos
You explain as if I am teaching myself 👌👌
Thank you luv bhaiyya you are putting your love and soul to this playlist ❤️❤️
You are to amazing that you are making video early in the morning
I appreciate your Hardwork
only who has watched till end knows about this xD
@@iamluv I have watched it bro till end.
Best explanation till date
Thanks from bottom of my heart .🙏
👏👏👏 appreciation for your efforts ❤️
Great explanation🔥...aur bloopers bhi Dekh Kar Maja aata hai😂
Is video ka Blooper sabse best h lol, and thanks a lot luv bhai aap humare liye itni mahenat kr rhe ho :)
What a unique approach ♥️♥️ Ly bhaiya ..I think this approach is not available on entire youtube except Luv ✌✌
Thanks for your effort sir !!
BEST APPROACH FOR THIS PROBLEM ON RUclips
U made Medium to hard problem as very very easy, thank you bro..❣
Definitely best implementation.
Rich content indeed.
~Take ♥ from Bangladesh
simple and unique idea to solve problem
u are amazing . thnx for ur hardwork.
how underrated you are!!
It is very disappointed to me.
This playlist is mind blowing, you deserve at least 1 million.
Love from Bangladesh!!!
Best teacher I have ever seen
Great explanation and unique solution ,, sir..😍
Love from Bangladesh 🇧🇩
great series
thankyou for this amazing content🤗.
Bhai course to badhiya hai hi aur saath me bloopers dekhke maza aa jaata😂😂😂
Please try to attach more practice questions. It is difficult to find good ONLY STL related questions. What we mostly get is mixed complex algorithm questions having the use of STL. It would help a lot. Thanks :)
First! Bhaiya jiss cheez mein bhi problem aati h na aap jaldi se ussi ki video post kr dete ho..
Really you are helping a lot
Matlab maine vector of vector and set of set kayi jagah search kare lekin smjh nhi aaye aapki video se sab smjh aagya...thanks a lot:)
Aap bahut hi badhiya padhate ho
Thank you sir ❤️
Mza aa gya unordered Map wla code dekh k
Understood sir❤🙇♂🙏
Love you bhaiya ❤️
❤️❤️best cp content on utube...u will get 100k subs within a month I know...
Thank You
subah ke 4:50 pe video ban rahe ho hamare lie thank you sirrrr
thank you 👌👌
Thanks!
Tq Bhaiya 🙏🙏🙏🙏♥️😊
Luv sir we appreciate your efforts and INT_MAX love from a freshie from your college
❤️❤️
Bloopers made this content enjoyable.
Thanks buddy 😊😊
u explain so well .woww☺
thanks a lot bro
Brilliant
Just found it! Amazing...
Thanks bro
Thank you bhaiya ❤️❤️
best_teacher_ever 🔥🔥🔥
awesome lets gooo !
bhai saahab code ho toh aisa !!! maza aa gaya logic dekh ke
thanks for this one...
Thanks 👍🏻
God bless you bahi
Thanks bhai
thanks
thank a lot
Genius !!!
Baground music is so good 😊
thanks bro its morning 4.50 am
Op sir
Super video bro 🇮🇳🌹🇮🇳
17:16 best part of the video🤣😂😂🤣😂😂
what a clever solution loved it
unordered map thing was smart :D
💯
op
Op
Excellent Gurujii
👍
Luv bhaiya ide k liye kux recommend kijiye c++ k liye m filhal atom use krra hun and mera vs code bht zyaada bug show krra h I don't know how to resolve it
Very nyc explaination you are giving loving it👍👍👍
hahahahahha best blooper bhai
Commenting for better reach
Mast content op yeah sab bhi likh skta hu per ( gold/ 💎) ko bolna tum expensive ho bolna nhi ho jaayega 🤔😅
can we check palindrome of , by this balanced bracket matching ?
all: teaching first
me: bloopers first
sir please make dsa series must needed now