Sum root to leaf numbers

Write codeMedium15 min

Your task

Given a binary tree as a level-order array (null for missing) where every node value is a digit 0-9, each root-to-leaf path spells a number formed by concatenating the digits from root to leaf. Return the sum of all such numbers. If the tree is empty, return 0.

Examples

sum_root_to_leaf(level: list) -> int
Example 1
Inputsum_root_to_leaf([1, 2, 3])
Output25