19. Root-to-Leaf Path Sum
EasyTrees
Return true if some root-to-leaf path adds up to target.
A binary tree is passed as TreeNode objects with val, left and right. The tests write trees in level order, with null for a missing child.
Example 1
Input: root = [5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1], target = 22 Output: true
Constraints
0 ≤ nodes ≤ 5000