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
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.
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 .
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 - th-cam.com/video/7Xeorb721LQ/w-d-xo.html */ /****************************************************** 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
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.
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; } }
kya hi explanation haiiiii. Mene khud karlia code
Superb explanation................
bhaiya seriously lots of love for your hardwork in making video❣❣
Means a lot
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. ❤
Means a lot 😇❤️🙏
You are the best DSA tutor in entire TH-cam. Most underrated
coding love h bhaiya because of you...
😇🙏🙏❤️
I could never have thought of this approach. Thanks ❤
Top notch ⭐️
Didn’t find any good video/article which explained this approach like this. You are unique
Mja aagya intna acha samjhaya hai ❤❤
Again I said in the first video earlier , the way you explain makes it easy to think and grasp the concept
🙏🙏
maza aa gaya bhai... thank you soo much
big fan yaar. love your explanations.
Brilliant solution and very well explained
Thanks
Amazing explanation! Mja Aa gya Sir
And Thanks sir for daily motivation Day : 55 streak continues 😃
Bhai you are just too good 🔥
Best explanation dete ho bhai aap
Great work 😊
Thank you so much 😀
Thank you sir for your hardwork and dedication,it helps us a lott!!!!🙏🙏🙏🙏
MIK bhai top notch explanation, Please start LLD lectures as well🙏
love u brotha ur way of explaining is superb!
Thank you so much 😀
You are a magician ❤
Superb explanation. Hats off
Great video 👌🏻
❤️😇
Was waiting eagerly for this ❣
Best explanation brother. Keep it up.
🙏🙏❤️❤️
Thanks a lot bhaiya fr the top notch explanation ❤🔥
Always welcome 🙏
this is fab fab
🙏🙏
🎉🎉
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
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.
bhaiya can u please also do solutions of upcoming leetcode contest
(Q3 and Q4) atleast
also Q4 of recent contests
I recently posted Qn-4 of Sunday contest. You can find it in my playlist - th-cam.com/video/SWNIGaOpV0U/w-d-xo.html
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 .
are u going to make video on today's gfg potd?
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 - th-cam.com/video/7Xeorb721LQ/w-d-xo.html
*/
/****************************************************** 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
@@codestorywithMIK thank you sir ♥️
very interesting approach explained so well 🫡🫡
🙏🙏❤️❤️
bhaiya, es question ko (3002. Maximum Size of a Set After Removals) kr denge plz, samjh nhi aa rha hai.
sir, one doubt, can't we convert the tree into undirected graph and then use dfs, like why and why not ?
Please tell
he already made video on this which was the first approach and this is the second approach. check the video section of his channel
@@shashanksaxena6699 it was with bfs right? Like I was asking for dfs but I think I should watch it again. Thanks 👍🏻
@@ashyy346 yes it was with bfs...you can try DFS also
bhaisahab aap famous question variation ko mention krna bhul gye. kripya krde vo bhi solve krlenge
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.
Bhaiya java me bhi code kiya karu ..... It will help us lot
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;
}
}
@@sachinnarang2453 thanks bhai 😇
Actually, i always put JAVA code in the same GitHub link in the description.
Hope that helps.
Thank you sachin for the Java code 😇❤️🙏
Do baar dekhna pada
i have solved this problem from your guidance 🙏 please make video on leetcode biweekly challenge. digits dp🎉❤