Binary Tree - 82: Get Max Sum path in binary tree

Описание к видео Binary Tree - 82: Get Max Sum path in binary tree

Source Code:https://thecodingsimplified.com/get-m...
Solution:
We start binary tree traversal in post order manner
We'll take a variable maxSum = 0
Now while traversing in post order, for each node, we'll compare with left & right node value
We'll store the max sum for a node with comparing its value with left & right
If at any moment, if this value is greater than maxSum value then update the maxSum value

Time Complexity: O(n)
Space Complexity: O(1)

Do Watch video for more info

CHECK OUT CODING SIMPLIFIED
   / codingsimplified  

★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 200+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplif...

★☆★ Send us mail at: ★☆★
Email: [email protected]

Комментарии

Информация по комментариям в разработке