Sum Root-to-Leaf Numbers

Asked at Meta · Coding Questions · Difficulty: Medium

Given a binary tree (as a level-order array where `None` marks a missing node) whose nodes each hold a digit `0-9`, each root-to-leaf path spells a number by concatenating digits. Return the sum of all such root-to-leaf numbers. A leaf has no children.

Loading the problem…