MaxPath Sum in Binary Tree
Closed this issue · 4 comments
AbhinandanGautam commented
MaxPathSum in Binary Tree
Algorithm :
- we travel recursively to leaf nodes of tree
- declare a global variable max_ans
- for each node we calculate 4 values
i. node value
ii. node value + maxSumPath(node->left)
iii. node value + maxSumPath(node->right)
iv. node value + maxSumPath(node->left) + maxSumPath(node->right) - find maximum value among these 4 and if this value greater than max then put it there
C++
- C
- C++
- Java
- Python
Additional context (OPTIONAL)
Add any other context or screenshots about the feature request here.
github-actions commented
It's great having you contribute to this project
Welcome to the community 🤓If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord STAR THE REPO
AbhinandanGautam commented
I am participating in Hacktober 2021
AbhinandanGautam commented
Please assign me this isssue
rakesh0x7 commented
Go and raise issue there https://github.com/gdsc-gvp/Problem-Solving
and Bot message doesn't mean to work on PR!