2
* Definition for a binary tree node.3
* function TreeNode(val, left, right) {4
* this.val = (val===undefined ? 0 : val)5
* this.left = (left===undefined ? null : left)6
* this.right = (right===undefined ? null : right)10
* @param {TreeNode} root13
var sumNumbers = function (root) {17
const dfs = (root, path = "") => {18
if (!root.left && !root.right) return +(path + root.val);20
const left = root.left ? dfs(root.left, path + root.val) : 0;21
const right = root.right ? dfs(root.right, path + root.val) : 0;