I don't know how do we even learn to think like that, the way you came up with the solution recursively, already having an intution what the final recursive call going to return and building up to the final solution. Do people who are really good at DSA just born with this talent? or does it come from practice. I don't think I'll even be able to be as good as you or any other DSA KZbinr. Some people are too good to be true. I'm really beating myself over it and getting depressed.
@HelloWorldbyprince2 жыл бұрын
nobody born with the talent expect Karna ( in mahabharat ) and u don't need to be like me or any other KZbinr u just have to be better than yourself bass be consistent buddy u will do it
@supriyamanna715 Жыл бұрын
woah woah woah, bhaiya has seen enough rejections and a hell lot of wrong ways of solving problems which make his explaination so easy, its same for all
@deep1998-j1v23 күн бұрын
This type of dry run i was looking for. I directly searched for your video bcz i knew it, i will get my doubt cleared. Great tutorial, as always.
@satyaprakashsingh9523 жыл бұрын
Guru ji pan papper wala sabse best hai isi pr continue rhiye
@HelloWorldbyprince3 жыл бұрын
Thanks 👍 dude
@AAYUSHSHARMAPCE21CS0029 ай бұрын
Finally I understood this topic just because of you!!!! Thankyou sirr!!!!❤
@ferozekhan4021 Жыл бұрын
Bhut acha smjhaty ho bhai. Thank u 🎉
@rohitsoni549110 ай бұрын
Great Video Brother :) my friend suggested your tree videos, truly commendable.
@akulanvn381 Жыл бұрын
Bhaiya you are the best in explaining thank you yaar. i understood everything so clear.
@kamalkushwaha49083 жыл бұрын
Got more clear understanding...Thanks🙏
@HelloWorldbyprince3 жыл бұрын
Thanks for sharing feedback
@AnkitKumar-oz6wl2 жыл бұрын
Bhaiya hum root->left mei kitne node hai unko store kar lenge ek variable mei and then root ->right ko bhi store kar lenge and maximum print kar denge. Sahi approach hai bhaiya
@HelloWorldbyprince2 жыл бұрын
yess, u can , lekin isse better ki ek baar iss approcah ko dry run kijiye and then please code karke submit kijiye and fir naya yaha comment karke mujhee v bataa dena aap
@vitaminprotein22172 жыл бұрын
we can do straight bfs traversal as height of the tree would be= no.of levels,but ya if height of left and right sub tree are asked the we can do like as taught vector ans; // edge case if(!root) return 0; queue q; q.push(root); while(!q.empty()) { vector temp; int size = q.size(); for(int i=0; ileft) q.push(node->left); if(node->right) q.push(node->right); temp.push_back(node->val); } ans.push_back(temp); } return ans.size(); }
@HelloWorldbyprince2 жыл бұрын
yes bro
@alexmercer58703 жыл бұрын
Arey Bhai Bhai bhai bhai! Kya mast smjhaate ho bhai❤️ Thanks for being exist🔥
@HelloWorldbyprince3 жыл бұрын
Thanks brother you exist for listening me
@mohitsrivastavaofficial11 ай бұрын
13:10 done.
@sudhadevi6692 Жыл бұрын
I was able to solve it from different approach .. but thanks for this ❤ 📹
@HelloWorldbyprince Жыл бұрын
Most welcome 😊
@tanvisharma68793 жыл бұрын
Homework Done! Can't thank you enough bhaiya:D
@HelloWorldbyprince3 жыл бұрын
Just spread this channel 😁
@itsaayush7357 Жыл бұрын
Bhaiya please AAP recursion tree se he recursion ka code btaya karo...usme concept ek dum badiya clear hota he...ese m dande bnakr thoda ajeeb sa lagta h
@AbhishekKumar-de3eo3 жыл бұрын
Question ko solve krne lga.. Total No. Of node se, leftmost,rightmost se 40 mins nikal gye.. most test fass rhe the After that, I view this full vedio... I was Like, Ekdum inhone wqt bdl diya, jazzbat bdl diye, zindgi bdl di...eh mazak ho rha hai 🥲
@HelloWorldbyprince2 жыл бұрын
Waooo thanks Abhishek keep learning
@349_rahulbhattacharya621 күн бұрын
i did the homework maxDepth=4
@cr7johnChan2 жыл бұрын
Aapke graph ki series ke karn yeh khud kar paya hoon . int maxDepth(TreeNode* root) { queueq; if(root==NULL)return 0; int ans=0; TreeNode*temp; q.push(root); while(!q.empty()){ int s=q.size(); while(s!=0){ temp=q.front(); q.pop(); if(temp->left!=NULL){ q.push(temp->left); }if(temp->right!=NULL){ q.push(temp->right); } s--; }ans++; }return ans; }
@HelloWorldbyprince2 жыл бұрын
thanks for the support buddy
@naitikrathore33172 жыл бұрын
This guy is very underrated
@maneeshapanu2 жыл бұрын
sir you explained really well thank you so much. Great explanation.
@HelloWorldbyprince2 жыл бұрын
You are most welcome
@patilashish2 жыл бұрын
Simple and accepted solution:- func maxDepth(_ root: TreeNode) -> Int { if root == null { return 0 } if root.left == null && root.right == null { return 1 } let maxDepthLeft = maxDepth(root.left) let maxDepthRight = maxDepth(root.right) return max(maxDepthLeft, maxDepthRight) + 1 }
@HelloWorldbyprince2 жыл бұрын
Waooo amazing
@sahiltakwale19372 жыл бұрын
🙏 Thanks a lot...
@HelloWorldbyprince2 жыл бұрын
welcome please please share this channel in your college group
@pranithreddy Жыл бұрын
Bhaiya nice explanation
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@gokulnaathb26273 жыл бұрын
Sir, very nice explanation, thank you so much
@HelloWorldbyprince3 жыл бұрын
You are most welcome
@nishabharti19713 жыл бұрын
Thanks bhaiya
@HelloWorldbyprince3 жыл бұрын
Your welcome Nisha Keep learning and sharing my channel with your friends and colleagues
@RN-jo8zt11 ай бұрын
definition of height of binary tree is really confusing according to definition Height of Binary tree is the number of edges along the longest path from root to leaf. where leaf node height is 0 . but here it's different and leaf node height is 1. can you pls explain which definition is correct ?
@devbhattacharya1533 жыл бұрын
Thanks a lot Prince Bhaiya
@HelloWorldbyprince3 жыл бұрын
keep learning bhai
@color26532 жыл бұрын
Thank you bro😀
@HelloWorldbyprince2 жыл бұрын
thanks for the support bro
@jayanth11913 жыл бұрын
Great explanation bro 💥
@HelloWorldbyprince3 жыл бұрын
Thanks buddy 😊😊
@cr7johnChan2 жыл бұрын
Done Bhai!!!!Shukriya
@HelloWorldbyprince2 жыл бұрын
🤩🤩
@AyushGupta-ux4gq3 жыл бұрын
Thanks bro😁😁
@HelloWorldbyprince3 жыл бұрын
Keep learning buddy
@sanjeevgupta22002 жыл бұрын
Sir Hume iska iterative solution ni krna haii ?? Ya karna chaiye
@wantbebigcoder2117 Жыл бұрын
Done
@HelloWorldbyprince Жыл бұрын
👏
@AmanSingh-ph9wg Жыл бұрын
done
@HelloWorldbyprince Жыл бұрын
nice
@shivduttjha35023 жыл бұрын
♥️♥️♥️
@HelloWorldbyprince3 жыл бұрын
Thanks buddy for lots of Love
@jeetkishore79722 жыл бұрын
int depth(node* root ) { static int h = 0; if (root == NULL) { return 0 ; } h++; if (root->left == NULL) { depth(root->right); } else if(root->right){ depth(root->left); } else return -1; return h; }
@HelloWorldbyprince2 жыл бұрын
good work dost keep learning
@abhisheksamboddu65802 жыл бұрын
class Solution { public: int h=0; int ans=0; int maxDepth(TreeNode* root) { findans(root); return ans; } void findans(TreeNode* root){ if(root!=NULL){ h++; ans=max(ans,h); findans(root->left); findans(root->right); h--; } } };