leetle

Daily challenge for 2026-02-01

397. Sum of Leaf Nodes

Given a binary tree represented as a list in level-order format (where null represents a missing node), calculate the sum of all leaf nodes. A leaf node is a node that has no children.

Example:
Input: root = [1, 2, 3, 4, null, null, 5] Output: 9 (4 and 5 are leaves).

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