Well, we are not avoiding recursion when the node is found isnt it? For example: getKthAncestor( root, 7, 1); will still undergo recursion for 2->right because 4 is returning NULL to 2, right?
Correction I think we are not the value 7 actually we are returning the Node which contains value 7 i Know for some this might be same thing but for beginners it can get a little bit confusing
Hi cpp nuts Is there any other way to become a patreon because my card was disabled for international transactions if you have any other way pls tell me I have also contacted my bank 🏦 they need more than a month .
Best solution till now present on youtube
Thanks
Well, we are not avoiding recursion when the node is found isnt it?
For example: getKthAncestor( root, 7, 1); will still undergo recursion for 2->right because 4 is returning NULL to 2, right?
I think removing the "return NULL;" when "k==0" should do the trick?
Correction I think we are not the value 7 actually we are returning the Node which contains value 7 i Know for some this might be same thing but for beginners it can get a little bit confusing
very nice and , very clear explanation sir thank you
Thanks and welcome
Good Solution...
Nice Explanation 😊
Glad you liked it
Got confused returning root at line 26 will work I was in an impression it may give false alarm to parent cl that we found the target
thanks!!!!!
Hi cpp nuts
Is there any other way to become a patreon because my card was disabled for international transactions if you have any other way pls tell me I have also contacted my bank 🏦 they need more than a month .
Thanks for the consideration, but no man i don't know any other way..
@@CppNuts ok sir thanks