Binary Tree - 81: Get Max Sum between two Leaves in Binary Tree

Описание к видео Binary Tree - 81: Get Max Sum between two Leaves 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 store left + right + node value
- 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]

Комментарии

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