Maximum Path Sum in a Binary Tree | GeeksforGeeks

preview_player
Показать описание


This video is contributed by Anant Patni

Please Like, Comment and Share the Video among your friends.

Follow us on Facebook:

And Twitter:

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

It is better to convey the crux of the problem than just bluntly reading out the code.

stym
Автор

one thing which is very hard to depict is the stack frame which includes the program counter, when a stack is popped and the function continues its execution, the information which line to execute is from the pc register from the stack frame, when l or r variable is assigned from recursive function, that is also a local variable, it does not stay in the stack.

spicytuna
Автор

I don't know why people disliked this but explanation at the geeksforgeeks channel is always good for me.
I learnt gfg youtube channel here, got placed with 25+ CTC.
Writing this comment because this ques. was asked to me today morning and I watched this vdo a day before interview and explained the solution very well to the interviewer.
hatsoff geeksforgeeks

shubhamagrawal
Автор

Hmm I know this can be a lot better but hey atleast these guys dedicated some time for all of us to know new and different questions.


I guess the only thing that adds the value to these videos by G4G is how the variables for example l, r, max and res change with each level in the call stack. Can do better G4G but thank you for your time in creating these questions. I appreciate!

vishalmahavratayajula
Автор

Actually we need to check out the branches from the root, and sum of branches to see what the global maximum at any point of execution is. Further, since we need to answer to the value of a branch, we return it.

rajnishupadhyay
Автор

the confusion part is the three max lines and the returning value. it is great the code is working. but need to explain. this is very confusing question from the start. we are dealing with recursive binary tree. that multiplies the complexity. need to slow down. i love the idea of tracing the code with an example. but this one is not intuitive.

spicytuna
Автор

Please try to explain the intuition behind the solution rather than just reading the code

phanichoragudi
Автор

This was similar to the following line of code...
int myVal=myVal+1; // increment myVal by 1

arifsaifee
Автор

Don't look the bad comments, go ahead man, you r so good in explanation but u also need to explain the logic of the program

CSBAjay
Автор

Pretty useless in my opinion. We know how to "read" code. What I guess people are looking for is how to come up with the code.

tanurampal
Автор

It is better not to post videos than posting videos like this. There is no clear explanation of the question nor the approach we are following to solve the problem. Creator is directly jumping into explaining code with a dry run. GeeksForGeeks is the go-to place for DS/PS/Algo for many developers around the globe and videos like this are just ruining the reputation.

chetan_bommu