Skip to content

Latest commit

 

History

History

Find The Maximum Sum In A Path From Leaf To Root

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given a Binary Tree, find the maximum sum path from a leaf to root. For example, in the following tree, there are three leaf to root paths 8->-2->10, -4->-2->10 and 7->10. The sums of these three paths are 16, 4 and 17 respectively. The maximum of them is 17 and the path for maximum is 7->10.

              10
           /      \
         -2        7
       /   \     
      8     -4