You are using an outdated browser. Please update your browser for a better user experience.

Sum Root to Leaf Numbers

tree current

Given a binary tree, where every node value is a Digit from 1-9 .Find the sum of all the numbers which are formed from root to leaf paths.

For example consider the following Binary Tree.

There are 4 leaves, hence 4 root to leaf paths:

Answer = 632 + 6357 + 6354 + 654 = 13997