Daily challenge for 2026-05-18
503. Deepest Leaf Path Sum
Given a binary tree represented as an adjacency list where the root is always node 0, find the sum of all node values that lie on the longest path(s) from the root to any leaf. If multiple paths have the same maximum length, return the sum of the values of the nodes on the path that has the greatest total sum. The input tree is an object where keys are node IDs and values are objects containing val (integer) and children (list of node IDs).
Example:Input: tree = { "0": { "val": 5, "children": [1] }, "1": { "val": 10, "children": [] } }Output: 15
Run this challenge interactively in Python or JavaScript when the app loads.