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

Комментарии • 215

  • @sabbysays
    @sabbysays 3 года назад +35

    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 💙

  • @manjeetpani4709
    @manjeetpani4709 3 года назад +57

    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 ❤️️❤️️❤️️

    • @piyushgarg511
      @piyushgarg511 2 года назад

      we can use pair instead of unordered map also ??

    • @yourfriendnur
      @yourfriendnur Год назад

      @@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.

    • @freefiretwo2756
      @freefiretwo2756 Год назад

      @@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" ;
      }

  • @madincreativity5961
    @madincreativity5961 3 года назад +80

    By seeing your competitive programming playlist.
    I can't give excuses to myself for not learning Computitve programming.
    Thank you bhai 😍😍😘😘😘😘

  • @codetuber8734
    @codetuber8734 2 года назад +7

    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 .
    👏❤️❤️

  • @aashishagrawal898
    @aashishagrawal898 3 года назад +14

    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

  • @subhasispanda4960
    @subhasispanda4960 3 года назад +36

    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 !!!🙏🙏🙏

  • @pranjalsingh3071
    @pranjalsingh3071 2 года назад +12

    I am pretty sure that this channel will grow exponentially because of having Amazing content

  • @god_is_riyal
    @god_is_riyal 3 года назад +1

    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.

  • @rasikaphutke8501
    @rasikaphutke8501 3 года назад +1

    Love your way of solving it differently sir !!

  • @sarwat3552
    @sarwat3552 3 года назад +1

    Brroooo,I was waiting for this 🔥🔥❤️

  • @InBracket
    @InBracket 3 года назад +2

    I never loved c++ but after your video i fall in luv with c++ with luv❤️

  • @funenjoynilaypatel4553
    @funenjoynilaypatel4553 2 года назад +3

    I love content of this channel very very helpful and no one gives this level of content

  • @josteins4501
    @josteins4501 3 года назад +1

    Awesome approach Bro!! Much appreciated.

  • @abhishekhorton79
    @abhishekhorton79 3 года назад +26

    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.

    • @Ak-um1yg
      @Ak-um1yg 2 года назад +3

      HOW R U NOW ? any did you improve more?

  • @039saranshvashisht8
    @039saranshvashisht8 2 года назад +2

    loved the way how easy you made this question😍😍

  • @ashishbhardwaj6696
    @ashishbhardwaj6696 3 года назад +51

    I Madara Uchiha , declare you the bestest teacher ever :)

    • @AnoNymOuS-mg9oj
      @AnoNymOuS-mg9oj 2 года назад +3

      Wake up to reality....

    • @dasanudasanudas
      @dasanudasanudas 2 года назад

      @@AnoNymOuS-mg9oj then you suggest some?

    • @citrus5127
      @citrus5127 2 года назад

      naruto ko dekha

    • @Daman1628
      @Daman1628 2 года назад +1

      He doesn't even remember your name, a fitting end perhaps

    • @ankitjaiswal8496
      @ankitjaiswal8496 Год назад

      Best itself is superlative

  • @AgnivaBanerjee6
    @AgnivaBanerjee6 3 года назад +2

    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

  • @iamgroot2810
    @iamgroot2810 2 года назад +3

    Thanks a lot for this playlist!

  • @debaratighatak2211
    @debaratighatak2211 2 года назад

    such an elegant code! :D wow❤️️

  • @mohdzaidkhan7001
    @mohdzaidkhan7001 2 года назад +1

    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

  • @vikramvikrant5851
    @vikramvikrant5851 3 года назад +3

    great approach and explanation 👌

  • @HimanshuPathak-mf8bc
    @HimanshuPathak-mf8bc Год назад +2

    bloopers are fun.....do include them.
    And your content obviously is best.

  • @mddinislam5904
    @mddinislam5904 Год назад +1

    Masterpiece, Love from Bangladesh....😍😍😍😍😍😍

  • @DHIRAJKUMAR-iw3dj
    @DHIRAJKUMAR-iw3dj 2 года назад

    awesome bro i saw this problem & solution multiple time but this solution is pretty more better

  • @RituKumari-hx5on
    @RituKumari-hx5on 2 года назад +1

    Your explanation are really rock. Thank you soo much😊😊

  • @parth8370
    @parth8370 3 года назад +1

    You are doing a great work broo..🔥

  • @user-ri8ju4el3l
    @user-ri8ju4el3l 3 года назад

    And again you rocked it bro!!

  • @roy_enigma
    @roy_enigma Год назад

    salute to see your hardwork bhiya , and thanks for the playlist . ❤

  • @ritikkhandelwal2358
    @ritikkhandelwal2358 3 года назад +4

    Luv Bhaiya you are simply amazing
    Can't thankyou much for the course......
    Par loving this.....
    And your efforts are awesome
    Appreciable ♥️

  • @jatinranjan7954
    @jatinranjan7954 2 года назад

    BEST !! CP course

  • @jayadubey_22
    @jayadubey_22 3 года назад +2

    thank you so much for such videos
    You explain as if I am teaching myself 👌👌

  • @vishaljain4642
    @vishaljain4642 3 года назад +17

    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

    • @iamluv
      @iamluv  3 года назад +28

      only who has watched till end knows about this xD

    • @manikantasai6118
      @manikantasai6118 3 года назад +1

      @@iamluv I have watched it bro till end.

  • @AyushSingh-he8ob
    @AyushSingh-he8ob 3 года назад

    Best explanation till date

  • @whoisprafull
    @whoisprafull 2 года назад

    Thanks from bottom of my heart .🙏

  • @badalwanjari4964
    @badalwanjari4964 2 года назад +1

    👏👏👏 appreciation for your efforts ❤️

  • @shakshi9108
    @shakshi9108 3 года назад +1

    Great explanation🔥...aur bloopers bhi Dekh Kar Maja aata hai😂

  • @rishabhkumar1170
    @rishabhkumar1170 3 года назад +1

    Is video ka Blooper sabse best h lol, and thanks a lot luv bhai aap humare liye itni mahenat kr rhe ho :)

  • @avibirla9863
    @avibirla9863 2 года назад

    What a unique approach ♥️♥️ Ly bhaiya ..I think this approach is not available on entire youtube except Luv ✌✌

  • @ahmedreza1755
    @ahmedreza1755 3 года назад +1

    Thanks for your effort sir !!

  • @TheAuraa
    @TheAuraa 3 года назад

    BEST APPROACH FOR THIS PROBLEM ON RUclips

  • @AppaniMadhavi
    @AppaniMadhavi 9 месяцев назад

    U made Medium to hard problem as very very easy, thank you bro..❣

  • @burning9708
    @burning9708 Год назад

    Definitely best implementation.
    Rich content indeed.
    ~Take ♥ from Bangladesh

  • @KaranKumar-qi7er
    @KaranKumar-qi7er 3 года назад

    simple and unique idea to solve problem

  • @131dash9
    @131dash9 2 года назад

    u are amazing . thnx for ur hardwork.

  • @md.hafizurrahman5436
    @md.hafizurrahman5436 2 года назад +1

    how underrated you are!!
    It is very disappointed to me.
    This playlist is mind blowing, you deserve at least 1 million.
    Love from Bangladesh!!!

  • @hasibuddin5216
    @hasibuddin5216 10 месяцев назад

    Best teacher I have ever seen

  • @tirthabarua7366
    @tirthabarua7366 3 года назад +2

    Great explanation and unique solution ,, sir..😍
    Love from Bangladesh 🇧🇩

  • @aman_sahu
    @aman_sahu 3 года назад +1

    great series

  • @jugal.suthar
    @jugal.suthar 2 года назад

    thankyou for this amazing content🤗.

  • @marvineriksen7230
    @marvineriksen7230 2 года назад

    Bhai course to badhiya hai hi aur saath me bloopers dekhke maza aa jaata😂😂😂

  • @aniketkhajanchi260
    @aniketkhajanchi260 3 года назад +6

    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 :)

  • @Newbie3130
    @Newbie3130 3 года назад

    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:)

  • @manojkumar-qm4mx
    @manojkumar-qm4mx 2 года назад

    Aap bahut hi badhiya padhate ho

  • @UECAshutoshKumar
    @UECAshutoshKumar Год назад +1

    Thank you sir ❤️

  • @sp-bp4fr
    @sp-bp4fr 2 года назад

    Mza aa gya unordered Map wla code dekh k

  • @Nitro-kx7ok
    @Nitro-kx7ok Год назад

    Understood sir❤🙇‍♂🙏

  • @abhaypratap9898
    @abhaypratap9898 2 года назад +1

    Love you bhaiya ❤️

  • @sippy8482
    @sippy8482 3 года назад

    ❤️❤️best cp content on utube...u will get 100k subs within a month I know...

  • @deepakmodi9343
    @deepakmodi9343 Год назад

    Thank You

  • @priyanshuagrawal7509
    @priyanshuagrawal7509 3 года назад +1

    subah ke 4:50 pe video ban rahe ho hamare lie thank you sirrrr

  • @nitishkumarram8978
    @nitishkumarram8978 Год назад +1

    thank you 👌👌

  • @ScienceSeekho
    @ScienceSeekho 2 года назад

    Thanks!

  • @good114
    @good114 2 года назад +1

    Tq Bhaiya 🙏🙏🙏🙏♥️😊

  • @abhijeetsingh9796
    @abhijeetsingh9796 3 года назад

    Luv sir we appreciate your efforts and INT_MAX love from a freshie from your college
    ❤️❤️

  • @roshangupta8161
    @roshangupta8161 2 года назад

    Bloopers made this content enjoyable.

  • @stevefox2318
    @stevefox2318 3 года назад +1

    Thanks buddy 😊😊

  • @SadhanaSharma
    @SadhanaSharma 2 года назад

    u explain so well .woww☺

  • @phenomenal_vs1511
    @phenomenal_vs1511 2 года назад

    thanks a lot bro

  • @firstjm9071
    @firstjm9071 2 года назад

    Brilliant

  • @pankajroy.4
    @pankajroy.4 2 года назад

    Just found it! Amazing...

  • @manikantasai6118
    @manikantasai6118 3 года назад

    Thanks bro

  • @AnuragSingh-jz9kz
    @AnuragSingh-jz9kz 3 года назад

    Thank you bhaiya ❤️❤️

  • @binarycode07
    @binarycode07 2 года назад

    best_teacher_ever 🔥🔥🔥

  • @soumiklaik5758
    @soumiklaik5758 3 года назад

    awesome lets gooo !

  • @prabhootpatel1654
    @prabhootpatel1654 10 месяцев назад

    bhai saahab code ho toh aisa !!! maza aa gaya logic dekh ke

  • @suryanshgupta4158
    @suryanshgupta4158 3 года назад

    thanks for this one...

  • @bhushanvashist7556
    @bhushanvashist7556 3 года назад

    Thanks 👍🏻

  • @Nhpkgaming
    @Nhpkgaming 2 года назад +1

    God bless you bahi

  • @darshantrivedi5390
    @darshantrivedi5390 3 года назад +2

    Thanks bhai

  • @lakeshkumar8230
    @lakeshkumar8230 2 года назад

    thanks

  • @sastory5213
    @sastory5213 Год назад

    thank a lot

  • @pramodkumarkar1688
    @pramodkumarkar1688 3 года назад

    Genius !!!

  • @abhimannyumagar1033
    @abhimannyumagar1033 2 года назад

    Baground music is so good 😊

  • @user-ej2df1ub3s
    @user-ej2df1ub3s 7 месяцев назад +1

    thanks bro its morning 4.50 am

  • @Nhpkgaming
    @Nhpkgaming 2 года назад +1

    Op sir

  • @papul6
    @papul6 3 года назад +1

    Super video bro 🇮🇳🌹🇮🇳

  • @parthkabra8880
    @parthkabra8880 3 года назад +2

    17:16 best part of the video🤣😂😂🤣😂😂

  • @aakarshitrekhi8071
    @aakarshitrekhi8071 3 года назад +1

    what a clever solution loved it

  • @aayush5474
    @aayush5474 3 года назад

    unordered map thing was smart :D

  • @utsavseth6573
    @utsavseth6573 Год назад

    💯

  • @lakeshkumar1281
    @lakeshkumar1281 2 года назад

    op

  • @yutaitadori7318
    @yutaitadori7318 3 года назад +1

    Op

  • @sonukumarnirala6896
    @sonukumarnirala6896 3 месяца назад +1

    Excellent Gurujii

  • @saumiltiwari14
    @saumiltiwari14 2 года назад

    👍

  • @ravitripathi9725
    @ravitripathi9725 3 года назад

    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👍👍👍

  • @abhishekhorton79
    @abhishekhorton79 3 года назад

    hahahahahha best blooper bhai

  • @pranshul..
    @pranshul.. 3 года назад +2

    Commenting for better reach
    Mast content op yeah sab bhi likh skta hu per ( gold/ 💎) ko bolna tum expensive ho bolna nhi ho jaayega 🤔😅

  • @kanandnaik5677
    @kanandnaik5677 2 года назад

    can we check palindrome of , by this balanced bracket matching ?

  • @parthkabra8880
    @parthkabra8880 3 года назад

    all: teaching first
    me: bloopers first

  • @kushjindal327
    @kushjindal327 3 года назад

    sir please make dsa series must needed now