310. Minimum Height Trees | BFS | Topological Sort | Graphs

  Переглядів 3,899

Aryan Mittal

Aryan Mittal

20 днів тому

In this video, I'll talk about how to solve Leetcode 310. Minimum Height Trees | BFS | Topological Sort | Graphs
Let's Connect:
📱Discord (Join Community) : / discord
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
💻 Twitter - / aryan_mittal007
🤖 Github: github.com/aryan-0077
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

КОМЕНТАРІ: 37
@ARYANMITTAL
@ARYANMITTAL 18 днів тому
Make sure, this is one such problem where Intuition is very important, WHY? is very important, so I'll highly recommend to watch Intuition part, no-one on yt will tell it, they will just show you❤💻
@user-no5mo9jv5m
@user-no5mo9jv5m 18 днів тому
This is the reason, you are the knly one i subscribed on YT for DSA. ❤
@keshavagarwal5900
@keshavagarwal5900 18 днів тому
Bro,A recommendation from my side.Today I searched MINIMUM HEIGHT TREE ON UKposts.I EXCEPTED UR VIDEO TO BE PRESENT THERE BUT THIS VIDEO WAS NOT IN THE LIST.EVEN I SCROLLED TO THE BOTTOM,THIS VIDEO WAS NOT THERE UNDER THE SEARCH OF"MINIMUM HEIGHT TREE".OTHER CHANNEL VIDEO ON THIS PROBLEM SOLN WAS THERE.THEN I SEARCHED "MINIMUM HEIGHT TREE BY ARYAN MITTAL".THEN ALSO THE VIDEO WAS NOT THERE.UR CHANNEL WAS COMING.THEN I WENT INTO UR CHANNEL AND FROM THERE I FOUND OUT THIS VIDEO. SO BASICALLY U DOING SO MUCH HARD WORK AND MAKING QUALITY VIDEOS AND STILL THE VIDEO NOT GETTING MUCH REACH .THE REASON IS THAT THE UKposts IS NOT RECOMMENDING UR VIDEOS OR UKposts ALGORITHM IS NOT PUSHING UR VIDEOS.THEREFORE ,U SHOULD DO SOMETHING TO RESOLVE THIS BCZ UR VIDEOS DESERVE TO GET MORE REACH.
@user-no5mo9jv5m
@user-no5mo9jv5m 18 днів тому
You could simply subscribe to his channel. Also a suggestion, It's harder to read the message with caps lock on. Kindly edit. Thanks 🤙🏻
@shubhammittal4389
@shubhammittal4389 17 днів тому
intuition is more important than actual algorithm 👍 GREAT EXPLANATION!!!
@SANJITNAVEEN
@SANJITNAVEEN 17 днів тому
dude you the most consistent content creator on internet right now.. that too top notch quality content. keep going man! I am with you
@Gnaneshh
@Gnaneshh 18 днів тому
The chain example was just mind blowing!
@codingkart245
@codingkart245 18 днів тому
Today I got to know the practical implementation of Topological Sort :) Thank you so much!
@ujjwalrockriser
@ujjwalrockriser 17 днів тому
You explained very well, I also thought similar, but I was doing with visited vector, I was not using the frequency vector. Thank you Aryan Bhaiya, you are my inspiration.
@lakeshkumar1252
@lakeshkumar1252 18 днів тому
thanks for consistently uploading videos
@ShubhamSingh-ud1mw
@ShubhamSingh-ud1mw 18 днів тому
very decent logic building and now i totally can think of many diffrent situation where i can use this logic. thanks aryan
@shivamjuyal3996
@shivamjuyal3996 18 днів тому
excellent explanation bhai !!
@kergeysarjakin5592
@kergeysarjakin5592 18 днів тому
Bro loved your intuituion you are the best .
@insaneclutchesyt948
@insaneclutchesyt948 18 днів тому
Excellent Explanation , thank you
@kcecse
@kcecse 17 днів тому
Your style ❤
@shivchauhan795
@shivchauhan795 18 днів тому
Its really informative. I hope one day I could solve and think intution like you. Inspiration❤
@HimanshuYadav-no4ul
@HimanshuYadav-no4ul 18 днів тому
well you helped a lot with your consistency of creating video my upsolving efficincey is very good all because of you
@vanshikaahuja766
@vanshikaahuja766 18 днів тому
it is jst so awsmm🤯🤯
@2amCoder
@2amCoder 18 днів тому
Nice work Bro!
@akankshamore7111
@akankshamore7111 18 днів тому
Excellent explanation!!!!!
@swastisrivastava4987
@swastisrivastava4987 18 днів тому
Thankyou... helpful
@tanyaraj3129
@tanyaraj3129 17 днів тому
good to go chief
@decodingNikhil
@decodingNikhil 18 днів тому
2:26 bohot yaarana lagta hai XD
@vijaybenz9741
@vijaybenz9741 18 днів тому
nice
@JIGARSINGTHAKOR-yy6qp
@JIGARSINGTHAKOR-yy6qp 18 днів тому
can i use priority queue instead of simple queue ?
@e2_04_abhijeetkumarsingh6
@e2_04_abhijeetkumarsingh6 15 днів тому
bhaiya can u please attach the pdf of the pages that u used here on notepad ??
@muntajir646
@muntajir646 18 днів тому
Please code in Java it will be really helpful. Thanks for the OP explanation
@user-cv6ed5cb9c
@user-cv6ed5cb9c 18 днів тому
NO Cpp Better. U need to learn Cpp🙂🙂
@muntajir646
@muntajir646 2 дні тому
@@user-cv6ed5cb9c I am coding in Java since my class 8 so I like Java more haha and there's no difference much it's just preferential
@bhavaygoel
@bhavaygoel 18 днів тому
bro your video is not coming in youtube search, are you shadowbanned? please confirm or do something. you are the best and it hurts to see this slow growth.
@diva573
@diva573 18 днів тому
Please do code in java and explain that too...
@arreactor2146
@arreactor2146 17 днів тому
I solved this question using maximum diameter but iam getting memory limit exceeded passed 70/71 testcases can anyone optimized it class Solution { vector diam; vector maxDiam(int prev, int curr, vector &adj){ vector temp1, temp2; for(auto &it: adj[curr]){ if(it!=prev){ vector node=maxDiam(curr, it, adj); if(node.size()>temp1.size()){ temp2=temp1; temp1=node; } else if(node.size()>temp2.size()){ temp2=node; } } } temp1.push_back(curr); if(temp1.size()+temp2.size()+1>diam.size()){ vector node=temp1; node.insert(node.end(), temp2.begin(), temp2.end()); diam=node; } return temp1; } public: vector findMinHeightTrees(int n, vector& edges) { if(n
@aastikofficial6100
@aastikofficial6100 17 днів тому
edge case do a simply check in starting if(n==1) return {0};
@arreactor2146
@arreactor2146 17 днів тому
@@aastikofficial6100 Recently solved by doing some change in my method Here is the code. class Solution { pair t1={0, 0}, t2={0, 0}; pair max_pair(pair &p1, pair &p2){ if(p2.second>=p1.second){ return p2; } else{ return p1; } } pair maxDiam(int node, int prev, vector &adj){ pair max1={0, 0}, max2={0, 0}; for(auto &it: adj[node]){ if(it!=prev){ pair temp=maxDiam(it, node, adj); if(max1.second
@gilfoyle2211
@gilfoyle2211 18 днів тому
karo bhai subscribe krte kyu nahi!!
@aastikofficial6100
@aastikofficial6100 18 днів тому
yr vo mja nhi h aapki explananation me thoda over kr dete ho therefore confusion ho jati h just a review from my side like everyone has different views and perspectives rest explanation is okay
Minimum Height Trees | LeetCode 310 | C++, Java, Python
27:05
Knowledge Center
Переглядів 16 тис.
Best OS for programming? Mac vs Windows vs Linux debate settled
8:41
The ARM chip race is getting wild… Apple M4 unveiled
4:07
Fireship
Переглядів 662 тис.
Minimum Height Trees 🔥🔥| Leetcode 310 | BFS
26:28
Ayushi Sharma
Переглядів 9 тис.
AI Talks at NVIDIA's Conference! Ft. @CodeWithHarry
17:52
Singh in USA
Переглядів 85 тис.
752. Open the Lock | BFS | Graph | Time Complexity | Why not DP?
25:58
Aryan Mittal
Переглядів 3,9 тис.