Agar aap ka bhai ek din google m bhi hogya na selection tho koi hairani ki baat nhi hogi bhot accha samjha the ho aap code ka hr ek line k bhot acche se explain krte ho
bhai youtube pr bhot sari videos hain but mai apke videos pr kyon ata hoon maloon hai?/KYONKI AP SAMJHA NE KE LIYE VIDEOS BNATE HO .... AUR SAB TH-cam KO .....POCKET MONEY KAMANE KA ZARIYA SMJHTE HAIN
//Khud kya hai bhai ,Thank you for making us believe in trying it ourselves int funct(TreeNode*root,TreeNode*p,vector&arr){ if(root==NULL)return 0; arr.push_back(root); if(root->val==p->val)return 1;
Itne saare videos dekhne ke baad ...sirf isi me smjh aaya ...finally ...thank u sir ji...
Your videos are very helpful....plese never stop this series 🙏🙏
Ekdum sure Saurabh
@@HelloWorldbyprince 😍💝
Agar aap ka bhai ek din google m bhi hogya na selection tho koi hairani ki baat nhi hogi
bhot accha samjha the ho aap
code ka hr ek line k bhot acche se explain krte ho
Prince sir videos thoda speed se upload karo. Daily ek video toh atleast kar diya karo. By the way awesome content next Aditya verma of tree 👍🏻
Aditya Verma is legend priya 🙂
Please make a series of BST also. 🙏🙏
Great content
ok sure i will uupload sonn
Very nicely explained bhaiya solution aache se samj me aaya hai your way of explanation is amazing
Thanks a lot lokesh
Best explanation of this code ever
Thanks a lot buddy
really thankyou bhaiya apke explanation ke liye
Thanks buddy
you the best bhaiya
sir plz make this type of awesome without worrying views and subscriber
make video on bst also bhaiya
Very nicely explained, bhaiya, thank you so much
Keep learning buddy 😊
Node* LCA(Node *root, int n1, int n2)
{
Node* ans=root;
int k=root->data;
if((n1==k) || (n2==k) || (n1k) ||(n1>k && n2k)
LCA(root->right,n1,n2);
}
nice buddy
Plz make more such videos on trees ☺️
sure muskan thanks for the support
op sir
You are just best.
Thanks a lot for your support
very well explained!!
Glad it was helpful!
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(!root) return NULL;
if(root->val== p->val || root->val== q->val) return root;
TreeNode* left = lowestCommonAncestor(root->left,p,q);
TreeNode* right =lowestCommonAncestor(root->right,p,q);
if(left && right) return root;
else if(left && !right) return left;
else if(!left && right) return right;
else return NULL;
}
};
bhai youtube pr bhot sari videos hain but mai apke videos pr kyon ata hoon maloon hai?/KYONKI AP SAMJHA NE KE LIYE VIDEOS BNATE HO .... AUR SAB TH-cam KO .....POCKET MONEY KAMANE KA ZARIYA SMJHTE HAIN
waoooo thanks a lot yaar ❤️
path. pop_back()
Bool wale function me end me ise use kyu kiye ho bhaiya
//Khud kya hai bhai ,Thank you for making us believe in trying it ourselves
int funct(TreeNode*root,TreeNode*p,vector&arr){
if(root==NULL)return 0;
arr.push_back(root);
if(root->val==p->val)return 1;
else{
if(funct(root->left,p,arr))return 1 ;
if(funct(root->right,p,arr))return 1;
}
arr.pop_back();
return 0;
}
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
vectorarr1;
vectorarr2;
funct(root,p,arr1);
funct(root,q,arr2);
int n=arr1.size(),m=arr2.size();
n= (n>m)?n:m;
int i;
for(i=0;ival!=arr2[i]->val)break;
}
return arr1[i-1];
}
Thoda jyada ho gaya hoga bt I'll try to improve
arr. Pop_back kyu kiye ho bhai
Bhiya aapne bahot aacha smjhaya mgr dimag kharab ho gya
.
Koi baat nahi
Dhere dhere samjh me aayega yaar
Ekdum se pressure mat lo