Minimize the Maximum Edge Weight of Graph | Detailed Intuition | BFS | DFS | Leetcode 3419 | MIK

  Рет қаралды 2,104

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 69
@codestorywithMIK
@codestorywithMIK 2 күн бұрын
🚨One Important Point - 🚨I should have mentioned above "threshold". There is a condition that "Each node has at most threshold outgoing edges." This condition doesn’t actually matter because, if it’s possible for every node to reach node 0, selecting just one edge per node is sufficient to ensure the graph remains connected.
@Nitinrautindore
@Nitinrautindore Күн бұрын
I didn't understand Mike what you are trying to say...please elaborate it.
@gui-codes
@gui-codes Күн бұрын
@@Nitinrautindore Threshold wala condition dekho dhyan se. "Each node has at most threshold outgoing edges." Matlab kisi bhi node se zyada se zyada threshold edges jaane chaie. But tum notice karo ki kisi bhi node se tumhe 0 me jana hai to obviosuly ek outgoing edge enough hoga from the node. And constraint me dekho threshold ki value 1
@jain5184
@jain5184 2 күн бұрын
Mik bhaiya want 2 things we the students are requesting u apka samjaya hua pura thought process dimag me jata hai even kabhi pehla consistent nhi tha apka subha motivation and then video thnku for all this but 1 apki sde sheet 2 dsa pattern recognition ispr video laao 3 for beginners to advance dsa course again ye app pr hai ki app launch karna chahta ho kuki honestly apka jesa ytber mene nhi dekha if u will for course jisme sabkuch included i will be infact bahut log course ke member hoga Again thanku if possible for u then it will be great help as u travel daily firbhi itna quality teaching content thought process salute u men 🫡
@gauravmundhada1647
@gauravmundhada1647 2 күн бұрын
Finally contest question! Personally I thought it of Kruskal variation
@sahebraojadhav9727
@sahebraojadhav9727 2 күн бұрын
Thank u note for mik.really love u mere bhai❤❤❤❤
@souravjoshi2293
@souravjoshi2293 2 күн бұрын
00:42 Goosebumps man. thanks a lot for working so hard for all of us
@Dungeon550
@Dungeon550 2 күн бұрын
I really want to thank MIK sir due to him is that i can enjoy doing DSA problems ,his explaination are just song to ear. Small request from MIK sir if in the future he can share his knowledge and teach important concepts about Development
@joydeepgharami403
@joydeepgharami403 2 күн бұрын
Thanks sir
@Himanshhhhxu
@Himanshhhhxu 2 күн бұрын
9:58 this was me😁 im still watching your video to get better understanding
@codestorywithMIK
@codestorywithMIK 2 күн бұрын
❤️😇🙏
@gui-codes
@gui-codes Күн бұрын
bhai tumne 3rd Qn contest me solve karliya tha ?
@Himanshhhhxu
@Himanshhhhxu Күн бұрын
@@gui-codes yes
@adityarawat3533
@adityarawat3533 4 сағат бұрын
motivation section is really good
@PriyanshuTyagi-ts2uw
@PriyanshuTyagi-ts2uw 2 күн бұрын
I figured out the reversing of the edges and mst by myself, got confused in the threshold thing, thanks!
@wearevacationuncoverers
@wearevacationuncoverers 2 күн бұрын
🎉 🎉 🎉 Contest qns. yayyyy
@thefinancialdiet4458
@thefinancialdiet4458 2 күн бұрын
Sir please provide the DSA Sheet as soon as possible, it will be of great help.....and also make a video on how to build intution of the question..... many of us can solve question by seeing ur solution but cant make on our own.... Lots of Loveee sirrrrrr 💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝💝
@gui-codes
@gui-codes 2 күн бұрын
yes MIK please
@DevanshGupta-io7rl
@DevanshGupta-io7rl 11 сағат бұрын
jeevan mai maza ab tab ayega jab aisa similar question khud se solve ho jaye live contest ya interview mai
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
mik sir abhi abhi just aaj ka constest virtually diya tha usme yahi sam equestion tha nhi bana mere se 😭😭😭😭 , please 4th one also
@Scienceboy1214
@Scienceboy1214 2 күн бұрын
bhaiya, 4th one of today's contest please
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
bro 4th bana kya tumse???
@RohitKumar-dz8dh
@RohitKumar-dz8dh 2 күн бұрын
Bhaiya agar time mile to leetcode 3413 problem ka bus approach note post kar dena na, isme sliding window interval k basis pe kese lagau samaj nahi a raha .
@NobitaNarrro
@NobitaNarrro 2 күн бұрын
Thanks Bhaiya... it was asked in leetcode contest 432
@aws_handles
@aws_handles 2 күн бұрын
Thanks a lot. I could not solve this during contest.
@KG-ts2cz
@KG-ts2cz 2 күн бұрын
Hey, I solved it using approach similar to Prim's algo after reversing the graph: class Solution { public: int minMaxWeight(int n, vector& edges, int threshold) { vector adj[n]; for(int i=0;i
@KG-ts2cz
@KG-ts2cz 2 күн бұрын
Mik, This code got accepted on leetcode, but Prim's is designed for undirected graphs. Can you please tell in which scenario or test case this code might fail?
@gui-codes
@gui-codes 2 күн бұрын
Thank you so much for contest qn 😭
@unknown47896
@unknown47896 2 күн бұрын
yes bro🥹🥹
@dayashankarlakhotia4943
@dayashankarlakhotia4943 2 күн бұрын
First 🎉❤
@unknown__899
@unknown__899 Күн бұрын
❤️❤️
@AYUSHMEHELDA
@AYUSHMEHELDA Күн бұрын
please make videoes for leetcode contest 3rd and 4th problems in every week
@italk-gj5kk
@italk-gj5kk 2 күн бұрын
please continue with contest solutions...
@prathamagarwal7304
@prathamagarwal7304 Күн бұрын
sir is there no use of the threshold integer which is given?
@codestorywithMIK
@codestorywithMIK Күн бұрын
Yes it is not required. Please do check the Pinned comment .
@prathamagarwal7304
@prathamagarwal7304 Күн бұрын
@ Thank you Sir
@somilplayzz9693
@somilplayzz9693 2 күн бұрын
Bhaiya maximum amount of robot can earn wale pr bhi bnado joh aaj ka 2 nd question tha contest ka
@EB-ot8uu
@EB-ot8uu 2 күн бұрын
MIK, travel karte waqt to araam karlo 😄
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
mik bhaiya 1 st approacvh jo mere dimag me aay atha vo minimum spanning tree vala tha ki like udar se banau , kya us se ban skta h ye question????
@gui-codes
@gui-codes 2 күн бұрын
Nahi bhai. MST works for undirected graphs, where all edges are bidirectional. This problem involves a directed graph, and MST algorithms (like Kruskal's or Prim's) are not designed to handle directionality. Also, the problem explicitly states that all nodes must have a path to node 0. MST focuses on creating a spanning tree with the minimum total weight and doesn’t inherently ensure that all nodes are reachable from a specific node.
@arjunkumaryadav8102
@arjunkumaryadav8102 2 күн бұрын
Bhaiya...Aap please jitne bhi contest hote hai unke hard aur medium questions kare video lekar aaya kariye
@arjunkumaryadav8102
@arjunkumaryadav8102 2 күн бұрын
Bhaiya Hard questions ko kaise approach kare....wo to bante hi nahi
@arjunkumaryadav8102
@arjunkumaryadav8102 2 күн бұрын
Bhaiyya....kyu na main he karu ki kisi bhi ek node start karu aur kosis karu ki 0 node tak pahuch jao aur jab udhar se true return karu to mark karte jao ke ye node visited aur and finally agr visited array me sare node true ho jaye to visited nahi to nahi hai
@codestorywithMIK
@codestorywithMIK 2 күн бұрын
Definitely you can try that. But when you start from any random node and try to reach 0, it’s not mandatory that you will cover all nodes.
@rode_atharva
@rode_atharva 2 күн бұрын
sir maine c++ me bahut dsa kiya hai. laki mai har baar kuch na kuch syntax bhool jata hu. i know python as well. maine python me dsa karna start kiya hai. mujhe ye comfertable lag raha hai. concept ke liye to me apka hi chaneel follow carta hu bas GPT se code python me convert kr leta hu. please sir bataye kya me sahi kar raha hu python for dsa leke ???. ha lekin c++ karna weste nahi kuki bahut se solution mil jate hai c++ mai
@imPriyansh77
@imPriyansh77 Күн бұрын
dsa is language independent...you should be able to come up with a logic
@DevanshGupta-io7rl
@DevanshGupta-io7rl 11 сағат бұрын
bhaiya ye to aagya smajh mai but live contest mai kaise itta strike krega wo bata dijiye kaise improve kru ???
@ParwezAlam-lj7qx
@ParwezAlam-lj7qx 2 күн бұрын
but you didn't consider the third condition (threshold outgoing edges) what about this. please explain
@codestorywithMIK
@codestorywithMIK Күн бұрын
Please do see the Pinned comment ❤️
@harsh_dhakad_Gamer
@harsh_dhakad_Gamer 2 күн бұрын
Sir in this question what js the use of that threshold U donot use that So why ?
@codestorywithMIK
@codestorywithMIK 2 күн бұрын
Hi Harsh, Please check the Pinned comment above ❤️😇🙏
@harsh_dhakad_Gamer
@harsh_dhakad_Gamer 2 күн бұрын
@codestorywithMIK yes thanks sir 🩷
@siikedia
@siikedia 2 күн бұрын
what about threshold?
@aws_handles
@aws_handles 2 күн бұрын
Because anyways we are removing edge. So, there is no chance of increasing the outgoing edges. Every time we remove edge, the outgoing edge is always reduced and hence will never cross the threshold.
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
it is getting handled automaticaaly already
@gui-codes
@gui-codes 2 күн бұрын
see the pinned comment bro
@sujalmahajan9673
@sujalmahajan9673 Күн бұрын
Although solved the problem but I have a doubt in it. Why threshold is not affecting the answer in actual
@codestorywithMIK
@codestorywithMIK Күн бұрын
Kindly check the Pinned comment ❤️
@siikedia
@siikedia 2 күн бұрын
do 3404. Count Special Subsequences
@sahebraojadhav9727
@sahebraojadhav9727 13 сағат бұрын
Guys can u tell me why my code giving TLE class Solution { public: void makeDfs(int start,unordered_mapgraph,int maxDist,vector&visited){ visited[start]=true; for(auto &pr:graph[start]){ int dest=pr.first; int dist=pr.second; // cout
@pinakvyas1779
@pinakvyas1779 2 күн бұрын
you didnt checked threshold
@aws_handles
@aws_handles 2 күн бұрын
Because anyways we are removing edge. So, there is no chance of increasing the outgoing edges. Every time we remove edge, the outgoing edge is always reduced and hence will never cross the threshold.
@gui-codes
@gui-codes 2 күн бұрын
see the pinned comment bro
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
mik bhaiya 1 st approacvh jo mere dimag me aay atha vo minimum spanning tree vala tha ki like udar se banau , kya us se ban skta h ye question????
@gui-codes
@gui-codes 2 күн бұрын
Nahi bhai. MST works for undirected graphs, where all edges are bidirectional. This problem involves a directed graph, and MST algorithms (like Kruskal's or Prim's) are not designed to handle directionality. Also, the problem explicitly states that all nodes must have a path to node 0. MST focuses on creating a spanning tree with the minimum total weight and doesn’t inherently ensure that all nodes are reachable from a specific node.
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
@@gui-codes thank u bro
@bhupendrakalal1727
@bhupendrakalal1727 2 күн бұрын
@@gui-codes bro can we connect on insta or any other social media??
@KG-ts2cz
@KG-ts2cz 2 күн бұрын
My code for Prim's got accepted after I reversed the graph and started from 0
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 333 М.
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
Netflix Removed React?
20:36
Theo - t3․gg
Рет қаралды 73 М.
Lecture 62: Binary Trees & its Representation || Different types of Traversals
55:06
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН