This question evaluates a candidate's ability to work with binary tree traversal and path-based numerical aggregation, testing competency in tree data structures and algorithmic reasoning within the Coding & Algorithms domain.

You are given the root of a binary tree where each node contains a single digit from 0 to 9.
Each root-to-leaf path represents a number obtained by concatenating the digits along the path from the root down to a leaf. For example, if a path is root → 1 → 2 → 3, it represents the number 123.
Write a function that returns the sum of all numbers formed by all root-to-leaf paths in the tree.
Constraints:
Describe your algorithm and its time and space complexity. You do not need to provide actual code.