G-50. Accounts Merge - DSU

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

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

  • @takeUforward
    @takeUforward  2 года назад +38

    Let's continue the habit of commenting “understood” if you got the entire video. Please give it a like too,.
    Do follow me on Instagram: striver_79

  • @kritikarawat2180
    @kritikarawat2180 Год назад +79

    I feel you are the best graph teacher bcz after watching graph videos in this channel i didnt looked at any other channel to understand any question.

  • @rishabhgupta9846
    @rishabhgupta9846 Год назад +52

    understood ,but for this solution even after knowing it is a DSU question such implementation is tough

  • @vishious14
    @vishious14 Год назад +9

    The best explanation. I was able to code it on my own as soon as you explained the approach.

  • @shivamandfriendsreact4089
    @shivamandfriendsreact4089 Месяц назад +1

    brooooo what ? !!!!! even neetcode couldn't explain this as good as you did. kudos man !!!

  • @1tav0
    @1tav0 Год назад +11

    this problem was awesome for my brain. Thank u so much for making it so clear striver understood

  • @arjundutta1515
    @arjundutta1515 6 месяцев назад +2

    I've explored a lot of youtube videos to understand graph. No one can exaplain with such a clarity and concept.
    I was also able to do similar kind of problems after learning the pattern. Greate playlist....

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 Год назад +5

    watched it twice!! but now understood it

  • @LBK3
    @LBK3 Год назад +5

    Understood ❤
    the intuition has been explained excellently

  • @aruna5869
    @aruna5869 11 месяцев назад +3

    understood. you are brilliant in finding suitable examples to make us understood❤

  • @lakshsinghania
    @lakshsinghania Год назад +3

    understood! with such a clarity.
    was not able to figure it out whether its DSU qs or not

  • @Moch117
    @Moch117 Год назад +2

    Thanks Striver. This problem is hard af even if you know its DSU

  • @beinghappy9223
    @beinghappy9223 Год назад +10

    Hell of a code . Amazing explanation

  • @mmbmmbmmb
    @mmbmmbmmb 11 месяцев назад

    GOATED dsa mentor/teacher. Understood.

  • @manishkarmakar3927
    @manishkarmakar3927 11 месяцев назад

    The way you explained the problem is simply mind blowing.... thanks bhaiyaa 💌

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

    understood💙💙💙
    just enjoying this amazing graph series
    superb explanation ❤

  • @harshalyallewar
    @harshalyallewar 3 месяца назад

    00:06 Merging similar accounts based on name and email accounts
    02:37 Merging accounts using disjoint set data structure.
    05:05 Understanding disjoint sets and merging elements
    07:45 Merging accounts in disjoint set data structure
    10:17 Merging accounts based on parent-child relationships.
    12:41 Using disjoint data structure to merge accounts efficiently
    14:58 Creating disjoint sets and merging accounts
    17:25 Merge accounts into ultimate parent and return list of lists
    19:48 Explaining the process of merging accounts using disjoint set data structure.
    21:45 Encouragement to remember you are valuable even when feeling broken-hearted.

  • @uknowme48
    @uknowme48 2 года назад +2

    "US" BHAIYA .....whenever the heart is broken....video dekh dekh kr song yaad ho gya hai

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

    its a tough one for sure but understood ur explaination , i need some time to digest it though

  • @stith_pragya
    @stith_pragya 11 месяцев назад +1

    Thank You So Much for this wonderful video.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @Rajat_maurya
    @Rajat_maurya 2 года назад +18

    understood
    no way i am going to guess this is a DSU question without prior practice

  • @Chandraprakash-kx4ic
    @Chandraprakash-kx4ic Год назад +1

    This series is Totally dope.. Thank You Striver.. ok ok forgot to write.. "UNDERSTOOD"

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

    Understood!!
    For this particular video, need to revise

  • @rushidesai2836
    @rushidesai2836 8 месяцев назад

    On second rewatch, understood it better.

  • @cinime
    @cinime 2 года назад +4

    Understood! Super amazing explanation as always, thank you very much!!

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

    Very good explanation, it makes life easy

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

    Brilliant Explanation

  • @KUMARSAURABH-s5i
    @KUMARSAURABH-s5i 5 месяцев назад

    brilliant explaination, thanks a lot striver

  • @factsworlda2k547
    @factsworlda2k547 8 месяцев назад

    you are amazing Striver 🙌🙌

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

    Understood
    Awesome explanation 🔥

  • @shitizgoel5027
    @shitizgoel5027 11 месяцев назад

    Very nice explanation bhaiya! Thanks

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

    Thank You so much striver bhaiyya for this amazing Graph Series !!

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

    understood. I solved it on my own just bcoz of ur awsome disjoint explanation video :)

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

    Disjoint set does these merging things pretty easy.

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

    Ye new and unique question tha bhaiya, understood.

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

    Thanku striver for giving such a great content.

  • @MadhavGupta-fi2tu
    @MadhavGupta-fi2tu Год назад +1

    They made it hard after strivers video

  • @r_uhi05
    @r_uhi05 7 месяцев назад

    understood! Great explanation.

  • @SunnyKumar-dw9ze
    @SunnyKumar-dw9ze Год назад

    Amazing explanation

  • @ayushman_sr
    @ayushman_sr 5 месяцев назад

    GFG doesn't take output in any order but Leetcode does, bug is there in GFG for this problem. I coded in python

  • @vanshpipaliya3217
    @vanshpipaliya3217 15 дней назад

    Using hashmap also this problem done 🤯

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

    awesome explanation Understood sir

  • @Xp-Sam
    @Xp-Sam 9 месяцев назад +1

    The problem is , If it wasn't mentioned DSU anywhere, I wouldn't have thought anything apart from maps and sets.

  • @mathy642
    @mathy642 11 месяцев назад

    Hey Striver
    Thank you for such wonderful explanation!!!:)

  • @devIOyu
    @devIOyu 2 месяца назад

    Thanks took me 2 and half hours to complete the implementation of this problem but never looked at the solution.
    But just finding the approach would take me weeks , thanks for the solution

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

    Awesome explanation bhaiya 🔥

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

    Great explanation sir

  • @PrajwalKakade
    @PrajwalKakade Год назад +11

    Those are getting WA on 56 on GFG, just sort the ans by adding this line before return statement.
    sort(ans.begin(), ans.end(), greater());

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

    Great Explanation

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

    Great explanation 🔥

  • @paragroy5359
    @paragroy5359 8 месяцев назад

    Thanks a lot.
    Nice video keep on making such videos.
    Awesome Content!!

  • @UECAshutoshKumar
    @UECAshutoshKumar 11 месяцев назад +1

    Thank you sir 😊

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

    understood maja aaa gya 😎😎🔥🔥

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

    inspiration for tier 3 college students

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

    Thanks so much striver!!!!

  • @gautamsaxena4647
    @gautamsaxena4647 2 месяца назад

    understood bhaiya

  • @ApnaVlogs-tj7do
    @ApnaVlogs-tj7do Год назад +1

    How can we come up to this type of solution of our own.

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

    understood bhaiya❣

  • @madhavgaur7096
    @madhavgaur7096 20 дней назад

    lol.. I was thinking in same way before seeing video ..but not confident...

  • @shauryatomer1058
    @shauryatomer1058 3 месяца назад

    thanks for the great content

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

    Understood Sir!

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

    very nice explantion sir

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

    It was HARD until Striver explaination

  • @PradneyaPrabhudesai
    @PradneyaPrabhudesai 2 месяца назад

    This is a tough question to crack..

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

    For instance, in the given input:
    john -> j1@com, j2@com, j3@com
    john -> j4@com
    raj -> r1@com, r2@com, r3@com
    john -> j1@com, j5@com
    raj -> r1@com, r3@com
    mary -> m1@com
    According to your explanation
    OUTPUT
    john -> j1@com, j2@com, j3@com, j4@com, j5@com
    raj -> 1@com, r2@com, r3@com
    mary -> m1@com
    But if the input is
    john -> j1@com, j2@com, j3@com
    john -> j4@com
    raj -> r1@com, r2@com, r3@com
    ram -> j1@com, j5@com
    raj -> r1@com, r3@com
    mary -> m1@com
    correct output is
    OUTPUT
    ram -> j1@com, j2@com, j3@com, j4@com, j5@com
    raj -> 1@com, r2@com, r3@com
    mary -> m1@com
    but according to your explanation, the output will be
    john -> j1@com, j2@com, j3@com, j4@com, j5@com
    raj -> 1@com, r2@com, r3@com
    mary -> m1@com
    because you are saying 3 ka ultimate parent is 0 but correct should be 0 ka ultimate parent 3

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

    In the example you are saying 3 ka ultimate parent is 0, but if 0 index name is john and 3rd index name is ram then in the list it will store john -> all emails, ideally instead of john there will be ram. In the code it is showing correct because 0 ka ultimate parent is 3. @takeUforward

    • @ZAP-25
      @ZAP-25 2 месяца назад

      Different people can not have same mail.

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

    Understood.

  • @RituSingh-ne1mk
    @RituSingh-ne1mk 9 месяцев назад

    Understood!

  • @averylazyandweirdhuman
    @averylazyandweirdhuman 5 месяцев назад

    Striver why don't we directly set the ultimate parent in the hashmap itself?

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

    isme instead of vectormergeMail[n] hum 2d vector of string le sakte hein kya?

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

      same question

    • @yt_deepx
      @yt_deepx 2 года назад +2

      yes you can, in that case you' ll use it as vector mergeMail(n);

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

      yeah he is using array of vectors , u can use vector of vector in place of that

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

    Understood❤

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

    actually i didnt find any diff between tuf and tuf++

  • @vigneshreddy1213
    @vigneshreddy1213 6 месяцев назад

    Hey Striver at Present the number of test cases were increased to 1151 then the intution you suggested suceeded till 400 change test cases can you make another video for avoidance of tle;

    • @vigneshreddy1213
      @vigneshreddy1213 6 месяцев назад

      And The Issue was resolved by the gfg customer care they increased time limit for the problem. Any way thankyou for this content

  • @ACUCSPRADEEPB-up9ne
    @ACUCSPRADEEPB-up9ne Год назад

    Understood✌️

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

    UNDERSTOOD

  • @tiyaroy4714
    @tiyaroy4714 4 месяца назад

    understood!!!

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

    Understoood R

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

    Understood!!

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

    understoood!!!

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

    understood🙌

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

    understood💖💖

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

    Supreme.

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

    Understood

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

    Thanks by heart

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

    yes

  • @World-Of-Mr-Motivater
    @World-Of-Mr-Motivater 5 месяцев назад +1

    striver since the map(incase of ordered map) already stores the mails in the sorted order
    is sorting the mail is neccessary?

    • @divyanshmishra5121
      @divyanshmishra5121 2 месяца назад

      ordered map stores the keys in sorted order, not the values of the keys

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

    how are we supposed to code sooo much in such short time. If it comes in coding test, we have to solve other questions as well. Amazing explanation tho.

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

    Thanks🙌

  • @rishabhranjan5162
    @rishabhranjan5162 4 месяца назад

    Damn this was tough

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

    Understood:)

  • @tgayush1424
    @tgayush1424 26 дней назад

    Awesome

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

    I have subscribed bro

  • @after_dark_777
    @after_dark_777 7 месяцев назад

    how does this code handle repeating mails?

  • @umakarthikrayudu5760
    @umakarthikrayudu5760 Год назад +3

    At 16:31 , I think its ds.unionBySize(mapMailNode[mail],i);

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

      why does it matter?

    • @adarshchaudhary6529
      @adarshchaudhary6529 8 месяцев назад

      You are correct it work in running the 3rd test case in gfg

  • @AMANZAKIRHUSAINMODAN
    @AMANZAKIRHUSAINMODAN 5 месяцев назад

    Just think for a moment you did not open this quen w/o learning graphs ! Were you able to solve this ??????

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

    Done!

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

    understood!

  • @vishalbairagi5364
    @vishalbairagi5364 4 месяца назад

    submit the solution to problem named accounts merge, merging details has some problem with test case 3 and test case 56

  • @AMANZAKIRHUSAINMODAN
    @AMANZAKIRHUSAINMODAN 5 месяцев назад

    I cant solve it w/o seeing soln is it okay and normal ?

  • @NiteshKumar-xm3nq
    @NiteshKumar-xm3nq 3 месяца назад

    do you uses mouse ?