leetle

Daily challenge for 2025-05-19

139. Sum Root to Leaf Numbers

Write a function solve that sums all numbers formed by root-to-leaf paths in a binary tree.

Example:
Input: [1,2,3]
Output: 25
Explanation: The root-to-leaf path 1->2 represents the number 12, and the root-to-leaf path 1->3 represents the number 13. Therefore, the sum is 12 + 13 = 25.

Run this challenge interactively in Python or JavaScript when the app loads.