Respect +++++++++++++++ , As always best content 💯💯💯💯💯
@unknown3807 ай бұрын
Your explanation is awesome man.
@krishanusaha52124 ай бұрын
Excellent bhaiya.. Can you provide more similar type questions
@josephstark5810 Жыл бұрын
one optimization while considering the edges in adj. list only consider a->b (when a is greater then b) or b->a(when b is greater then a) tell why? because when we only go from large value to small not need to mark activated nodes
@nabajyotimajumdar45115 ай бұрын
Quality content!
@paraspandey5772 жыл бұрын
Excellent explanation man. Using the idea of stitching up the graph instead of breaking the graph is brilliant.
@hemanthkumartirupati Жыл бұрын
Best explanation video on youtube
@akshayyadav112 Жыл бұрын
now i am more confused, but u explained well
@anvesh53772 жыл бұрын
Instead of creating is_active array, at the time of creating adj list we add a edge if vals[u] >= vals[v] then G[u].push_back[v] else G[v].push_back[u] . This thing makesures that the bigger value nodes connected to smaller value nodes at the time union operation. And also time complexity will be reduced since the number of adj_nodes are less for a node.
@codingmohan2 жыл бұрын
Overall time complexity will not be affected as in this case you are just iterating over all the edges exactly twice and in your approach we'll be iterating over edges exactly once. But yes, this will remove the need of "is_active" array. Good point :)
@JohnWick-kh7ow Жыл бұрын
What is the time and space complexity of the solution?
@hemantranjan2297 Жыл бұрын
Time Complexity: O(n), Space Complexity: O(n)
@JohnWick-kh7ow Жыл бұрын
@@hemantranjan2297 how?
@hemantranjan2297 Жыл бұрын
@@JohnWick-kh7ow As we are iterating over all the valued nodes once, and findLeader(Time complexity would be inverse Ackermann function i.e
@blasttrash Жыл бұрын
@@hemantranjan2297 what about sorting? it should be nlogn for TC i think. Even on leetcode they mention nlogn for TC.
@sunilpanchal1498 Жыл бұрын
Super Explanation 😃😃
@bitterthread67942 жыл бұрын
This question was well formed for HARD category and well explained here..
@mr.s7767 Жыл бұрын
If I use nC2 formula it doesn't work. But it works if I use n * ((n - 1)/2). Why?
@HARSHYADAV-qe9zz9 ай бұрын
when you use nC2 formula it will calculate factorial for 'n' and 'n-2' then it divides them to get the result. The values are quite huge and it also take some time. Maybe that's why it was not working.
@thedevtutorials Жыл бұрын
Epic Explanation !!!
@akashyadav3211 Жыл бұрын
Damn...thanks u cleared my doubt xC2
@niladrisekharnath2 жыл бұрын
Great Explanation Thank You so much
@freezefrancis Жыл бұрын
Simple explaination to very hard problem. Well done. I could immediately code it up after watching your video.
@arnabnandy2828 Жыл бұрын
Excellent explanation
@hymnish_you2 жыл бұрын
Cool explanation!!! Bro, I came up with the solution but I am hell lazy to get it implemented. Slept just 4 hours ;( Anyways will try my best next time.
@codingmohan2 жыл бұрын
Next time you get the same feeling, make sure to copy-paste DSU code from somewhere (you can use mine if you want :P) and write the core logic :)
@giraffe43752 жыл бұрын
thanks
@varunmanchanda39722 жыл бұрын
Is this Small to Large DSU based question?
@codingmohan2 жыл бұрын
Not really. This problem doesn't really depends on that concept. This just exercised DSU to keep track of the connected component.
@codingwithanonymous890 Жыл бұрын
I am still having hard time understanding any good blogfor this pls suggest
@Truysジャ Жыл бұрын
Nice explanation sir
@Heartless-he8km Жыл бұрын
dimag ka dahi kar diya bhai aapne.
@streetcode42842 жыл бұрын
Amazing explanation
@lofibeats23442 жыл бұрын
Why you didnot upload maximum and su string solution?
@codingmohan2 жыл бұрын
Do you want me to record it? I looked at it after 20 mins into the contest and already 6K+ people had solved it. So, haven't uploaded it. I can upload it if you feel that I can add some value. Let me know :)
@lofibeats23442 жыл бұрын
@@codingmohan yes this type of problems are coming frequently in recent contest.
@jaddajaswanthkumar11642 жыл бұрын
Superb explanation bro
@shubhankarnath75732 жыл бұрын
This solution is really really awesome bro , nice thought 😎🔥
@karannnful2 жыл бұрын
time complexity?
@rohit90032 жыл бұрын
This is my first time watching your video and i understood it in one go , gg great explanation !!!
@prafullprajapati36432 жыл бұрын
good explaination
@mohdaasimqureshi71152 жыл бұрын
Great Explanation 👏👏👏
@SHREYANSHSHARMA-y9o Жыл бұрын
big Fan sir
@XxelitebeautyxX2 жыл бұрын
Amazing work!
@laxmikanthreddy43932 жыл бұрын
Excellent explanation bro . Keep posting you will definitely gonna reach large number of audience