Root-to-Leaf Target Sum
Return True if some root-to-leaf path has values summing to target.
Trees are given in level order as a list, with None for a missing child (for example [3, 9, 20, None, None, 15, 7]).
Examples
EXAMPLE WALKTHROUGHfound
A guided view of the published example, not a trace of your code.
INPUT
[[5,4,8,11,null,13,4,7,2,null,null,null,1],22]TASKtarget_path_sum()
EXPECTED OUTPUT
trueStart with the input values shown in this example.
Example 1 of 3
Input: values = [5,4,8,11,null,13,4,7,2,null,null,null,1], arg2 = 22
Output: true
Explanation: found
Input: values = [1,2,3], arg2 = 5
Output: false
Explanation: not found
Input: values = [], arg2 = 0
Output: false
Explanation: empty tree
Hint 1
Subtract each node's value from the target on the way down; check for zero at a leaf.