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....
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.
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
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
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
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;
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.
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
understood
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.
understood ,but for this solution even after knowing it is a DSU question such implementation is tough
The best explanation. I was able to code it on my own as soon as you explained the approach.
brooooo what ? !!!!! even neetcode couldn't explain this as good as you did. kudos man !!!
this problem was awesome for my brain. Thank u so much for making it so clear striver understood
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....
watched it twice!! but now understood it
Understood ❤
the intuition has been explained excellently
understood. you are brilliant in finding suitable examples to make us understood❤
understood! with such a clarity.
was not able to figure it out whether its DSU qs or not
Thanks Striver. This problem is hard af even if you know its DSU
Hell of a code . Amazing explanation
GOATED dsa mentor/teacher. Understood.
The way you explained the problem is simply mind blowing.... thanks bhaiyaa 💌
understood💙💙💙
just enjoying this amazing graph series
superb explanation ❤
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.
"US" BHAIYA .....whenever the heart is broken....video dekh dekh kr song yaad ho gya hai
your*
its a tough one for sure but understood ur explaination , i need some time to digest it though
Thank You So Much for this wonderful video.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
understood
no way i am going to guess this is a DSU question without prior practice
This series is Totally dope.. Thank You Striver.. ok ok forgot to write.. "UNDERSTOOD"
Understood!!
For this particular video, need to revise
On second rewatch, understood it better.
Understood! Super amazing explanation as always, thank you very much!!
Very good explanation, it makes life easy
Brilliant Explanation
brilliant explaination, thanks a lot striver
you are amazing Striver 🙌🙌
Understood
Awesome explanation 🔥
Very nice explanation bhaiya! Thanks
Thank You so much striver bhaiyya for this amazing Graph Series !!
understood. I solved it on my own just bcoz of ur awsome disjoint explanation video :)
Disjoint set does these merging things pretty easy.
Ye new and unique question tha bhaiya, understood.
Thanku striver for giving such a great content.
They made it hard after strivers video
understood! Great explanation.
Amazing explanation
GFG doesn't take output in any order but Leetcode does, bug is there in GFG for this problem. I coded in python
Using hashmap also this problem done 🤯
awesome explanation Understood sir
The problem is , If it wasn't mentioned DSU anywhere, I wouldn't have thought anything apart from maps and sets.
Hey Striver
Thank you for such wonderful explanation!!!:)
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
Awesome explanation bhaiya 🔥
Great explanation sir
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());
Dhanyavaad
Bro, can you explain what is actually happening here????
@@ayushanand6957 sorting in descending order ig
What is the reason behind this extra greater function?
It gives wrong ans for some other test cases.
Great Explanation
Great explanation 🔥
Thanks a lot.
Nice video keep on making such videos.
Awesome Content!!
Thank you sir 😊
understood maja aaa gya 😎😎🔥🔥
inspiration for tier 3 college students
Thanks so much striver!!!!
understood bhaiya
How can we come up to this type of solution of our own.
understood bhaiya❣
lol.. I was thinking in same way before seeing video ..but not confident...
thanks for the great content
Understood Sir!
very nice explantion sir
It was HARD until Striver explaination
This is a tough question to crack..
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
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
Different people can not have same mail.
Understood.
Understood!
Striver why don't we directly set the ultimate parent in the hashmap itself?
isme instead of vectormergeMail[n] hum 2d vector of string le sakte hein kya?
same question
yes you can, in that case you' ll use it as vector mergeMail(n);
yeah he is using array of vectors , u can use vector of vector in place of that
Understood❤
actually i didnt find any diff between tuf and tuf++
😂
andhuke nenu kuda tesukole
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;
And The Issue was resolved by the gfg customer care they increased time limit for the problem. Any way thankyou for this content
Understood✌️
UNDERSTOOD
understood!!!
Understoood R
Understood!!
understoood!!!
understood🙌
understood💖💖
Supreme.
Understood
Thanks by heart
Understood!
yes
striver since the map(incase of ordered map) already stores the mails in the sorted order
is sorting the mail is neccessary?
ordered map stores the keys in sorted order, not the values of the keys
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.
Thanks🙌
Damn this was tough
Understood:)
Awesome
I have subscribed bro
how does this code handle repeating mails?
At 16:31 , I think its ds.unionBySize(mapMailNode[mail],i);
why does it matter?
You are correct it work in running the 3rd test case in gfg
Just think for a moment you did not open this quen w/o learning graphs ! Were you able to solve this ??????
Done!
understood!
submit the solution to problem named accounts merge, merging details has some problem with test case 3 and test case 56
I cant solve it w/o seeing soln is it okay and normal ?
do you uses mouse ?