Given the root of a binary tree and an integer
targetSum, is there a root-to-leaf path whose values sum to targetSum?Example 1
Input: root = [1,2,3], targetSum = 5
Output: false
Explanation: No path to a leaf gives sum 5.
Output: false
Explanation: No path to a leaf gives sum 5.
Example 2
Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22
Output: true
Explanation: The path 5→4→11→2 gives sum 22.
Output: true
Explanation: The path 5→4→11→2 gives sum 22.