Use a recursive function to process the left and right sides: return the largest.
Think about it:
If you look at one of the smallest branches:
You have two totals: 11, and 6.
You can the treat that result as a node for the node above.
No explicit loop is needed, the recursion handles that.
Try it on paper: you'll see what I mean.