Amount of Time for Binary Tree to Be Infected | Using DFS | One Pass | Leetcode 2385

  Рет қаралды 3,975

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 60
@kunalbhatia8587
@kunalbhatia8587 10 ай бұрын
kya hi explanation haiiiii. Mene khud karlia code Superb explanation................
@lofireverbz-wy7go
@lofireverbz-wy7go 10 ай бұрын
bhaiya seriously lots of love for your hardwork in making video❣❣
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Means a lot
@md.tamaltahasinkhan6448
@md.tamaltahasinkhan6448 10 ай бұрын
You have named the channel perfectly. You are a true story teller. I enjoy each and every videos of your channel as like reading my favourite novel. ❤
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Means a lot 😇❤️🙏
@DevOpskagyaan
@DevOpskagyaan 10 ай бұрын
You are the best DSA tutor in entire KZbin. Most underrated
@sauravchandra10
@sauravchandra10 3 ай бұрын
I could never have thought of this approach. Thanks ❤
@nishantchoudhary4230
@nishantchoudhary4230 10 ай бұрын
coding love h bhaiya because of you...
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
😇🙏🙏❤️
@aws_handles
@aws_handles 10 ай бұрын
Top notch ⭐️ Didn’t find any good video/article which explained this approach like this. You are unique
@divyadahiya9161
@divyadahiya9161 4 ай бұрын
Mja aagya intna acha samjhaya hai ❤❤
@akagi937
@akagi937 10 ай бұрын
Again I said in the first video earlier , the way you explain makes it easy to think and grasp the concept
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
🙏🙏
@harshittyagi911
@harshittyagi911 5 ай бұрын
maza aa gaya bhai... thank you soo much
@gui-codes
@gui-codes 6 ай бұрын
big fan yaar. love your explanations.
@yatharthgupta6468
@yatharthgupta6468 9 ай бұрын
Brilliant solution and very well explained Thanks
@prateekgirilateralentry5865
@prateekgirilateralentry5865 10 ай бұрын
Amazing explanation! Mja Aa gya Sir And Thanks sir for daily motivation Day : 55 streak continues 😃
@codingdev4196
@codingdev4196 9 ай бұрын
Bhai you are just too good 🔥 Best explanation dete ho bhai aap Great work 😊
@codestorywithMIK
@codestorywithMIK 9 ай бұрын
Thank you so much 😀
@cooldude0321
@cooldude0321 10 ай бұрын
Thank you sir for your hardwork and dedication,it helps us a lott!!!!🙏🙏🙏🙏
@Whirlwind03
@Whirlwind03 10 ай бұрын
MIK bhai top notch explanation, Please start LLD lectures as well🙏
@phoenix1814
@phoenix1814 10 ай бұрын
love u brotha ur way of explaining is superb!
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Thank you so much 😀
@DevOpskagyaan
@DevOpskagyaan 10 ай бұрын
You are a magician ❤
@souravjoshi2293
@souravjoshi2293 10 ай бұрын
Superb explanation. Hats off
@anuppatankar4294
@anuppatankar4294 10 ай бұрын
Great video 👌🏻
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
❤️😇
@wearevacationuncoverers
@wearevacationuncoverers 10 ай бұрын
Was waiting eagerly for this ❣
@u_NIK_
@u_NIK_ 10 ай бұрын
Best explanation brother. Keep it up.
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
🙏🙏❤️❤️
@gauravbanerjee2898
@gauravbanerjee2898 10 ай бұрын
Thanks a lot bhaiya fr the top notch explanation ❤🔥
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Always welcome 🙏
@ashyy346
@ashyy346 10 ай бұрын
this is fab fab
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
🙏🙏
@knowsbetter4113
@knowsbetter4113 10 ай бұрын
🎉🎉
@atmanirbharofficialindiaon2789
@atmanirbharofficialindiaon2789 10 ай бұрын
Hey plsss tell the ques u mentioned in the video similar to this one and link also of leetcode for that ques i want to test my skills after understanding of this ques
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Aha my bad, The question was asked in Meta Coding Round (Pen and Paper) : Write a program which can take input root of a binary tree and a target value. It should find the farthest leaf distance from the target value. This problem (video) is nothing but the same Qn but with twisted words.
@movieShorts-nv1uf
@movieShorts-nv1uf 10 ай бұрын
2977. Minimum Cost to Convert String II . Vai plz make a vedio on this problem . Actually stuck on this problem . It's like to much hard to go . Please explain it and make a vedio .
@jambajuice07
@jambajuice07 10 ай бұрын
bhaiya can u please also do solutions of upcoming leetcode contest (Q3 and Q4) atleast also Q4 of recent contests
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
I recently posted Qn-4 of Sunday contest. You can find it in my playlist - kzbin.info/www/bejne/iYixenqXhNWJZrc
@RajSingh-te1uo
@RajSingh-te1uo 10 ай бұрын
are u going to make video on today's gfg potd?
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Hi Raj, Actually a very similar Qn video is already there in my playlist. Using that same concept you can solve this also. Let me share the code and the video too. /* NOTE - Using same concept as Leetcode 974. Subarray Sums Divisible by K Video - kzbin.info/www/bejne/bYnIoKWYbJdkgrM */ /****************************************************** C++ *************************************************************/ //T.C : O(n) //S.C : O(n) class Solution{ public: int longSubarrWthSumDivByK(int nums[], int n, int k) { unordered_map mp; int sum = 0; mp[0] = -1; int result = 0; for(int i = 0; i
@RajSingh-te1uo
@RajSingh-te1uo 10 ай бұрын
@@codestorywithMIK thank you sir ♥️
@YashSinghal
@YashSinghal 10 ай бұрын
very interesting approach explained so well 🫡🫡
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
🙏🙏❤️❤️
@abhishekrai3
@abhishekrai3 10 ай бұрын
bhaiya, es question ko (3002. Maximum Size of a Set After Removals) kr denge plz, samjh nhi aa rha hai.
@ashyy346
@ashyy346 10 ай бұрын
sir, one doubt, can't we convert the tree into undirected graph and then use dfs, like why and why not ? Please tell
@shashanksaxena6699
@shashanksaxena6699 10 ай бұрын
he already made video on this which was the first approach and this is the second approach. check the video section of his channel
@ashyy346
@ashyy346 10 ай бұрын
@@shashanksaxena6699 it was with bfs right? Like I was asking for dfs but I think I should watch it again. Thanks 👍🏻
@shashanksaxena6699
@shashanksaxena6699 10 ай бұрын
@@ashyy346 yes it was with bfs...you can try DFS also
@harshtiwari416
@harshtiwari416 10 ай бұрын
bhaisahab aap famous question variation ko mention krna bhul gye. kripya krde vo bhi solve krlenge
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Aha my bad, The question was asked in Meta Coding Round (Pen and Paper) : Write a program which can take input root of a binary tree and a target value. It should find the farthest leaf distance from the target value. This problem (video) is nothing but the same Qn but with twisted words.
@shivanshupandey1106
@shivanshupandey1106 10 ай бұрын
Bhaiya java me bhi code kiya karu ..... It will help us lot
@sachinnarang2453
@sachinnarang2453 10 ай бұрын
class Solution { private int ans = Integer.MIN_VALUE; private int dfs(TreeNode root, int start){ if(root==null) return 0; int left = dfs(root.left,start); int right = dfs(root.right,start); if(root.val==start){ int distance = Math.max(left,right); ans = Math.max(distance,ans); // ya toh ye wala diff max hoga return -1; } else if(left>=0 && right>=0) return 1+Math.max(left,right); else{ int distance=Math.abs(left)+Math.abs(right); ans = Math.max(distance,ans); //Ya toh ye diff max hoga return -1+Math.min(left,right); } } public int amountOfTime(TreeNode root, int start) { dfs(root,start); return ans; } }
@shivanshupandey1106
@shivanshupandey1106 10 ай бұрын
@@sachinnarang2453 thanks bhai 😇
@codestorywithMIK
@codestorywithMIK 10 ай бұрын
Actually, i always put JAVA code in the same GitHub link in the description. Hope that helps. Thank you sachin for the Java code 😇❤️🙏
@ManojKrVerma-vw4dx
@ManojKrVerma-vw4dx 10 ай бұрын
Do baar dekhna pada
@dayashankarlakhotia4943
@dayashankarlakhotia4943 10 ай бұрын
i have solved this problem from your guidance 🙏 please make video on leetcode biweekly challenge. digits dp🎉❤
@teamamroninja333
@teamamroninja333 Ай бұрын
OpenCV Course - Full Tutorial with Python
3:41:42
freeCodeCamp.org
Рет қаралды 3,9 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,2 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,7 МЛН
Why is Python 150X slower than C?
10:45
Mehul - Codedamn
Рет қаралды 17 М.
Sum of Distances in Tree | Google | Leetcode 834 | codestorywithMIK
44:46
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,2 МЛН